0% found this document useful (0 votes)
2 views4 pages

Understanding Process Management Concepts

Uploaded by

nguyenvan2308199
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Understanding Process Management Concepts

Uploaded by

nguyenvan2308199
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Chapter 3 : Processes

I) Process Concept
1) The Process
- A process is a program in execution
- Each process has its own memory layout
+ The memory layout of a process is usually divided into multiple sections, and it’s
shown in the table below:

+ Text section: The executable code


+ Data section: Global variables
+ Heap section: Memory that is dynamically allocated during program runtime
+ Stack section: Temporary data storage when invoking functions (Such as function
parameters, return address, and local variables)
+ Text and data sections are fixed but heap and stack sections can grow and shrink
dynamically during the program runtime
+ Each time a function is called, an activation record (containing function
parameters, return address,and local variables) is pushed into stack. When control is
returned from the function, the activation record is popped out from stack.
+ Heap and stack grow toward each other, but the system must ensure that they
don’t overlap
- A program becomes a process when it’s executed (An executable file is loaded into
the main memory)
- Although many processes are associated with a program, they are nevertheless
considered different processes.
2) Process State
- When a process is running, it changes the state
- A process may have one of the following states:
+ New: Process is being created
+ Running: Instructions are being executed
+ Waiting: A process is waiting for some events to occur
+ Ready: A process is waiting to be assigned to a processor
+ Terminated: The process has finished execution
3) Process Control Block (PCB)
+ Each process is represented in an operating system by a process control block
+ It contains many pieces of information associated with a specific process,
including these:
 Process state: The state may be new, ready, running, waiting, halted, and so on.
 Programcounter: Thecounterindicatestheaddressofthenextinstruction to be
executed for this process.

 CPU registers: The registers vary in number and type, depending on the computer
architecture.

 CPU-scheduling information: This information includes a process prior ity,


pointers to scheduling queues, and any other scheduling parameters.

 Memory-management information: This information may include such items as


the value of thebase andlimitregistersand 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.

4) Threads
+ A thread refers to a sequence of instructions that is running
+ If a process is a single thread, only one thread can be executed at a time. For
example, you cannot type on the keyboard and move the mouse concurrently
+ Multiplethread can execute more than one sequence of instructions at the same
time

II) Process Scheduling


+ Process Scheduler: Selects an available process for program execution on a core
+ The number of processes in the memory is known as the degree of
multiprogramming
+ If the CPU only has one core, only one process runs at a time
1) Scheduling Queue
+ As a process enters the system, it’s put into a ready queue, where it is ready
and waiting to execute on a CPU’s core.
- The system also includes others queue:

+ I/O Wait Queue: A process could issue an I/O request and be placed into I/O wait
queue
+ Child Termination Wait Queue: A process could create a new child process and
wait for it to be completed. Therefore, it’s placed into child termination wait queue
+ Interrupt Wait Queue: A process could issue an interrupt request to regain CPU
control
2) CPU Scheduling
- The role of the CPU scheduler is to select the processes that are in the ready queue
and allocate a CPU core to one of them.
- The I/O-bound process is a process that tends toward I/O than CPU operation.
Otherwise, the CPU-bound performs more CPU operation than IO operation.
- Swapping is a technique in which a process can be “swapped out” from the memory
to the disk (to reduce the degree of multiprogramming), where its current state is
saved, and later “swapped in” from the disk to the memory
3) Context Switch
- When an interrupt occurs, or CPU changes from one process to another,the current
state of the process needs to be saved.
- This current state is saved as a process control block (PCB)
- The diagram below shows the steps of context switch:
III) Operating on Processes
1) Process Creation
- When a process is created by another process, it is called a child of the process
creating it. A process can have many children.
- Each process that is created will be assigned an identifier called process identifier
(pid), usually an interger number.
' ' '
y=x y + y − y ' ln ⁡( y )

You might also like