1 / 32

Operating Systems (CS 340 D)

Learn about the process concept in operating systems, including features like scheduling, creation, termination, and communication. Explore the various states of a process and the role of process control blocks. Understand the process scheduling queues and the different types of schedulers.

alexanderc
Download Presentation

Operating Systems (CS 340 D)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Princess Nora University Faculty of Computer & Information Systems Computer science Department Operating Systems (CS 340 D) Dr. Abeer Mahmoud

  2. (Chapter-3)Process-Concept

  3. Chapter 3: Process-Concept Process Concept Process Scheduling Inter-process Communication Dr. Abeer Mahmoud

  4. OBJECTIVES: • To introduce the notion of a process • To describe the various features of processes, including scheduling, creation and termination, and communication Dr. Abeer Mahmoud

  5. Process Concept • System consists of a collection of processes: • Operating system processes executing system code • User processes executing user code • The terms joband processare used almost interchangeably, and both refer to the same meaning: = ( a program that is loaded into memory and in execution) Dr. Abeer Mahmoud

  6. Process Concept (cont..) • Program : is a collection of instruction in a code manner, which is sometimes known as the text section. • Program = passive entity • Process=Active entity • Process :is more general than program as it includes more details such as : • Text section • Stack- • Data section: • The current activity: • Heap Dr. Abeer Mahmoud

  7. The Process (cont..) contains temporary data (such as function parameters, return addresses, and local variables The current activity: the value of the program counter & contents of the processor’s registers. is memory that is dynamically allocated during process run time. which contains global variables. which is program code . Dr. Abeer Mahmoud

  8. Process State • As a process executes, it changes state • New: the process is being created • Running: instructions are being executed • Waiting: the process is waiting for some event to occur (e.g. An I/O completion). • Ready: the process is waiting to be assigned to a processor • Terminated: the process has finished execution • Only one process can be running on any processor at any instant. Many processes may bereadyand waiting. Dr. Abeer Mahmoud

  9. Diagram of Process State Dr. Abeer Mahmoud

  10. Process Control Block (PCB) • Each process is represented in the operating system by a process control block (PCB) • PCB containsmany information including : Dr. Abeer Mahmoud

  11. Process Control Block (PCB) (cont..) Dr. Abeer Mahmoud

  12. CPU Switch From Process to Process Dr. Abeer Mahmoud

  13. PROCESS SCHEDULING Dr. Abeer Mahmoud

  14. Process Scheduling • Multiprogramming aims to have some process running at all times to maximize CPU utilization. • Time sharing aims to switch the CPU among processes so frequently user interact with each program while it is running. • Process scheduler selects an process (from a set of several available processes) for execution on the CPU. Dr. Abeer Mahmoud

  15. Process Scheduling Queues • Job queue– set of all processes in the system • Ready queue – set of all processes residing in main memory, ready and waiting to execute • This queue is generally stored as a linked list. • Device queues– set of processes waiting for an I/O device • Each device has its own device queue Dr. Abeer Mahmoud

  16. Process Scheduling Queues (cont.) • Processes migrate among the various queues: • A new process is initially put in the ready queue. • It waitsthere until it is selected for execution. • Once the process is allocated the CPU and is executing, one of several events could occur: Dr. Abeer Mahmoud

  17. Process Scheduling Queues (cont.) • A process continues this cycle until it terminates, at which time it is removed from all queues and has its PCB and resources deallocated. Dr. Abeer Mahmoud

  18. Representation of Process Scheduling Queuing diagram Dr. Abeer Mahmoud

  19. Schedulers • The operating system must select processes scheduling for these queues. • The selection process is carried out by the appropriate scheduler. • Long-term scheduler(or job scheduler) – selects which processes should be brought from mass-storage into RAM (to the ready queue ) • Short-term scheduler(or CPU scheduler) – selects which process (from ready queue) should be executed next and allocates CPU Dr. Abeer Mahmoud

  20. Schedulers • Short-term scheduler is invoked very frequently (milliseconds)  (must be fast) • Long-term scheduler is invoked very infrequently (seconds, minutes)  (may be slow) • The long-term scheduler: controls the degree of multiprogramming Dr. Abeer Mahmoud

  21. Schedulers (Cont) • Processes can be described as either: Dr. Abeer Mahmoud

  22. Schedulers (Cont) • The long-term scheduler must select a good process mix of I/O-bound and CPU-bound processes to improve total performance. Dr. Abeer Mahmoud

  23. Medium Term Scheduling • Sometimes it can be advantageous to remove processes from RAM…….(swap out) • Later, the process can be reintroduced into RAM …….(swap in), and its execution can be continued where it left off. • This scheme is called swapping. ( done by medium-term scheduler) • Swapping may be necessary to improve the process mix • Or because a change in memory requirements has exceeded available memory Dr. Abeer Mahmoud

  24. Addition of Medium Term Scheduling Dr. Abeer Mahmoud

  25. INTERPROCESS COMMUNICATION Dr. Abeer Mahmoud

  26. Interprocess Communication Processes within a system may be Dr. Abeer Mahmoud

  27. Interprocess Communication • Reasons (/advantages) for cooperating processes: • Information sharing : (e.g. shared file) • Computation speedup: • To make a particular task run faster, we must break it into subtasks, each of which will be executing in parallel with the others. • This can be achieved only if the computer has multiple processing elements (e.g. CPUs). Dr. Abeer Mahmoud

  28. Interprocess Communication • Reasons (/advantages) for cooperating processes: 3. Modularity: • We may want to construct the system in a modular fashion (i.e. dividing the system functions into separate processes) 4. Convenience • An individual user may work on many tasks at the same time. Dr. Abeer Mahmoud

  29. Interprocess Communication (Cont.) • Cooperating processes need interprocess communication (IPC) • IPC: mechanism that will allow cooperating processes to exchange data and information. Dr. Abeer Mahmoud

  30. Interprocess Communication (Cont.) Two models of IPC: process can exchange information by Dr. Abeer Mahmoud

  31. Communications Models • Shared memory model • Message passing model Dr. Abeer Mahmoud

  32. Thank you End of Chapter 3 Dr. Abeer Mahmoud

More Related