Text Book: Abraham Silberschatz, Peter Baer Galvin and Greg Gagne, “Operating System
Concepts”, 9thEdition,John Wiley and Sons Inc., 2018.
3.1 Process Management
A process is an instance of aprogram in execution.
• An operatingsystem executes avarietyof programs:
1. Batch system – jobs
2. Time-shared systems – user programs or tasks The Process
• Process memoryisdivided into four sections.
1. The program code, also called text section
Current activity including program counter, processor registers
2. Stack containing temporary data
Function parameters, return addresses, local variables
3. Data section containing global variables
4. Heap containing memory dynamically allocated during run time
A Process in memory
• A program is a passive entity, such as a file containing a list of instructions stored on
disk (often called an executable file).
• A process is an active entity, with a program counter specifying the next instruction to
execute and a set of associated resources.
1
,21CS208 – Operating Systems Unit-III
• A program becomes a process when an executable file is loaded into memory.
• As a process executes, it changes state.
• The state of a process is defined in part by the current activity of that process.
• A process maybe in one of the following states:
1. New The process is being created.
2. RunningInstructions are being executed.
3. Waiting The process is waiting for some event to occur (such as an I/O
completion or reception of a signal).
4. Ready The process is waiting to be assigned to a processor.
5. Terminated The process has finished execution.
Process State
• It is important that only one process can be running on any process or at any instant.
• Many processes maybe ready and waiting.
Process Control Block
• Each process is represented in the operating system by a process control block
(PCB)—also called a task control block.
• The PCB simply serves as the repository for any information that may vary from process
to process.
• It contains many pieces of information associated with a specific process.
ProcessControlBlock
2
,21CS208 – Operating Systems Unit-III
• Process state - The state maybe new, ready, running, waiting, halted, and so on.
• Program counter - The counter indicates the address of the next instruction to be
executed for this process.
• CPU registers - The registers vary in number and type, depending on the computer
architecture. They include accumulators, index registers, stack pointers, and general-
purpose registers, plus any condition-code information. Along with the program
counter, this state information must be saved when an interrupt occurs, to allow the
process to be continued correctly afterward.
CPU switches from process to process
3
, 21CS208 – Operating Systems Unit-III
• CPU- scheduling information. This information includes a process priority, pointers
to scheduling queues, and any other scheduling parameters.
• Memory- management information. This information may include such items as the
value of the base and limit registers and the page tables, or the segment tables,
depending on the memory system used by the operating system
• Accounting information. This information includes the amount of CPU and real time
used, time limits, account numbers, job or process numbers, and so on.
• I/O status information. This information includes the list of I/O devices allocated to
the process, a list of open files, and so on.
Process Scheduling
• The objective of multi programming is to have some process running at all times, to
maximize CPU utilization.
• The objective of time sharing is to switch the CPU among processes so frequently that
users can interact with each program while it is running.
• Process scheduler–selects an available process (possibly from a set of several
available processes) for program execution on the CPU.
• 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. A ready-
queue header contains pointers to the first and final PCBs in the list. Each
PCB includes a pointer field that points to the next PCB in the ready queue.
• Device queues– set of processes waiting for an I/O device. Each device has its
own device queue
• Ready Queue and various I/O device Queues
Schedulers
• A process migrates among the various scheduling queues throughout its lifetime. The
operating system must select, for scheduling purposes, processes from these queues in
some fashion.
• The selection process is carried out by the appropriate scheduler.
• Long-term scheduler (or job scheduler)–selects which processes should be brought
into the ready queue from the pool
4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller praveenkumar.m1. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.