0% found this document useful (0 votes)
9 views

Chapter 3 Processes

Ch3

Uploaded by

Abdi Adamu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Chapter 3 Processes

Ch3

Uploaded by

Abdi Adamu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Chapter 3 Processes

Subjects: operating system

● Process is a program in execution, which forms the basis of all computation.


● The program code, also called text section
● Current activity including program counter, and the contents of the processor’s
registers
● Stack containing temporary data
● Function parameters and local variables
● Data section containing global and static variables
● Heap which is a memory that is dynamically allocated during process run time
● One program can be several processes.

_the data, heap, and stack sections vary.


● As a process executes, it changes its state. The state of a process is defined by the
current activity of that process.

● new: The process is being created

● ready: The process is waiting to be assigned to a processor

● running: Instructions are being executed by the processor

● waiting: The process is waiting for some event to occur

● terminated: The process has finished execution


A PCB is a data structure maintained by the OS and contains information associated with
each process (also called task control block) including these:

● Process state – current state of the process e.g. new, ready, running, waiting, etc.

● Process privileges - this is required to allow/disallow access to system resources.

● Process ID - unique identification for each of the process in the operating system.

● Pointer - a pointer to parent process.


● Program counter –indicates the address of the next instruction to be executed for
this process.

● CPU registers – contents of all process-centric registers

● CPU scheduling information- priorities, scheduling queue pointers

● Memory-management information – memory allocated to the process

● Accounting information – CPU used, clock time elapsed since start, time limits

● I/O status information – I/O devices allocated to process, list of open files

● Process scheduling is the removal of the running process from the CPU and the
selection of another process from the ready queue to maximize CPU utilization.

● Process scheduler selects among available processes for next execution on CPU.
● Maintains scheduling queues of processes

● Job queue – set of all processes in the system

● Ready queue – set of all processes residing in main memory, ready and waiting
to execute

● Device (I/O) queue – set of processes waiting for an I/O device

● Two types of Schedulers

● Short-term scheduler (or CPU scheduler) – selects from among the


processes that are ready to execute and allocates the CPU to one of them.
● Long-term scheduler (or job scheduler) – selects processes from job pool
and loads them into ready queue (memory) for execution.

● The primary distinction between CPU scheduler and job scheduler lies in frequency of
execution.
● Medium-term scheduler can be added if degree of multiprogramming needs to
decrease using swapping.

● Context of a process represented in the PCB of the process.

● Context-switch time is pure overhead, because the system does no useful work while
switching.

● Context-switch times are highly dependent on hardware support.

● System must provide mechanisms for:

● process creation

● process termination
● A process may create several new processes, via a create-process() system
call, during the course of execution.

4 1The creating process: parent process

4 The new processes: children of that process.

4 Each of these new processes may in turn create other processes, forming
a tree of processes.

● Resource sharing options

4 Parent and children share all resources

4 Children share subset of parent’s resources

4 Parent and child share no resources


● Process Termination : A process terminates when it finishes executing its
final statement .
● Zombie is a process that has finished the execution but still has an entry in the
process table to report to its parent process who's already terminated.

● Orphan is a process running and its parent terminated without invoking wait()
system call

● Two types of Interprocess Communication

1: independent : Any process that does not share data with any other process
is independent.

2: cooperating :Any process that shares data with other processes is a


cooperating process.

● Reasons for cooperating processes:

● Information sharing: users may be interested in the same piece of information.

● Computation speedup: If we want a particular task to run faster, we must


break it into subtasks, each of which will be executing in parallel with the others.

● Modularity: dividing the system functions into separate processes or threads.

● Convenience: an individual user may work on many tasks at the same time.

● Producer process produces information that is consumed by a consumer process.


Two types of buffers can be used:

● unbounded-buffer: places no practical limit on the size of the buffer.

● bounded-buffer: assumes that there is a fixed buffer size.

● Two models of IPC

4 Shared memory

4 Message passing

END
BY: Abdirahman Abdulahi Farah
CLASS : CA2013

You might also like