0% found this document useful (0 votes)
11 views10 pages

OS Concept Related To PM

The document discusses process management in multiuser systems, highlighting how operating systems enable multiple users to execute programs simultaneously while managing CPU time and resources. It explains concepts such as processes, multiprogramming, context switching, process states, scheduling, and priority, emphasizing the importance of efficient CPU utilization and fairness among users. Additionally, it covers multitasking and time-sharing, illustrating how these mechanisms enhance user experience and system performance.

Uploaded by

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

OS Concept Related To PM

The document discusses process management in multiuser systems, highlighting how operating systems enable multiple users to execute programs simultaneously while managing CPU time and resources. It explains concepts such as processes, multiprogramming, context switching, process states, scheduling, and priority, emphasizing the importance of efficient CPU utilization and fairness among users. Additionally, it covers multitasking and time-sharing, illustrating how these mechanisms enhance user experience and system performance.

Uploaded by

doraemonxyz99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Concept related to process management

User 1 User 2 User 3 User n


CPU
HDD .....
OS
Apps
Turbo C++ Turbo C++ Ms-Word Turbo C++

Main computer (Server)


• In multiuser system, many users and programmers sit at their respective terminals and
execute the same or different programs.
• Despite many users working on the same system, each one feels as if the entire system
is being used by him only.
• This is made possible by operating system.
• The disk stores programs and data for all users.
• The operating system enables CPU to switch from one user to another.
• The operating system allocates CPU time to users.
• This is done by process management.
Process
• A process is a program under execution, which competes for the CPU time and
other resources.
• A program loaded into main memory for execution becomes a process.
User 1 User 2 User 3 User n
CPU
HDD .....
OS
Apps
Turbo C++ Turbo C++ Ms-Word Turbo C++

Main computer (Server)

Multiprogramming / Context switching


• A Single user cannot keep either CPU or the I/O devices busy at all times.
• Multiprogramming is an attempt to increase CPU utilization by always having
something for CPU to execute.
• In multiprogramming we can run two processes simultaneously.
• If process 1 waits for an I/O, CPU executes process 2 and vice versa.
• That is, CPU cannot remain idle as long as there is some process to execute.
• There would be some time lost in turning attention from process 1 to process 2. It
is called Context switching.
Multiprogramming / Context switching
RUN 1 RUN 2 RUN 1 • The number of process running
Idle Idle
(Process 1) (Process 2) (Process 1) simultaneously and competing
Context switching
for the CPU is known as the
Fig. : CPU utilization with two processes
degree of multiprogramming.
• As this increases, CPU utilization increases, but then each process may get a delayed attention.
Context switching
• Context switching stands for turning attention of CPU from one process to another.
• While context switching the memory contents of old process are stored somewhere,
otherwise restarting this process would be impossible.
• The status of CPU registers and pointers to memory are stored in specific memory area
called Register Save area and then CPU starts executing another process.
• Both the processes are in main memory even after context switch.
• After some time, the old process is scheduled again and CPU executes it from where it
had left from.
• The time lost in context switching is very low.
Process states :
• in order to manage switching between processes, the operating system defines
three basic process states. 1. Running 2. Ready 3. Blocked.
X Y Z
(Process 1) (Process 2) (Process 3)
2+3
CPU for I/O
Waiting CPU
1. Running: CPU can execute only one process at any given moment. This process is
termed as running process.
2. Ready: A process which is not waiting for any external event such as an I/O
operation and which is not running is said to be in ready state.
3. Blocked: When process is waiting for an external event such as an I/O operation
the process is said to be in blocked state.

A blocked process cannot be scheduled even if CPU is free, whereas ready process
can be scheduled if CPU is free.
Process Scheduling
• While scheduling various processes, the operating system has to choose a set of
objectives to be achieved. Some of the objectives are listed below:
1. Fairness
2. Good throughput
3. Good CPU utilization channel link :
https://www.youtube.com/c/ComputerScienceAcademy7
4. Low turnaround time
5. Low waiting time
6. Good response time
• Some of these objectives are conflicting to each other.
• Fairness refers to being Fair to every user in terms of CPU time.
• Throughput refers to the total productive work done by all the users put together.
• CPU utilization is the fraction of the time that the CPU is busy.
• If time slice is very small, the context switches will be more frequent.
• Hence CPU will be busy with operating system than that of user processes,
• i.e. throughput will be low, but CPU utilization will be high.
Process Scheduling
• Turnaround time is the elapsed time between time a program or job is submitted
and the time when it is completed.
• Waiting time is the time a job spends waiting in the queue of the newly
implemented processes for the operating system to allocate resources to it before
commencing its execution.
• The waiting is necessary due to competition from other jobs/processes.
• Response time is the time to respond with an answer or result to a question or an
event.
• It depends on degree of multiprogramming, efficiency of hardware and policy of
operating system to allocate resources.
• The response time is extremely important for on-line, or real time systems.
Priority :
• The concept of priority is important since many processes are competing to each
other for resources like CPU time and memory.
• The priority can be global (external) or local (internal).
1. The external priority
• The external priority is specified by user externally at the time of initiating a
process.
• Even during execution it can be changed.
• If user does not specify priority, then default priority is assigned.
• For urgent jobs; high priority can be assigned.
2. The internal priority
• The internal priority is specified by Operating system internally.
• The internal priority is based on calculation of current state of process.
• For example, each user, while firing a process, can be forced to also specify the
expected time that the process is likely to take for completion.
• The operating system can then set internal priority which is highest for shortest job.
• Here we get two advantages.
• One shortest jobs, are finished faster and second, at any given time the number of
processes competing CPU will decrease.
• But if small jobs keeps coming on, large jobs may suffer from indefinite
postponement.
• This can be avoided by setting external high priority to those important large jobs.
• The operating system calculates a resultant priority based on both external and
internal priorities.
3. The Purchase priority
• In commercial data centers where each user pays for the time used, normally
higher priority processes are charged at higher rate to prevent each user from
firing his job at highest priority known as purchase priority.
• Some operating systems do not operate on concept of priority, but instead they
have a fixed time slice for each process.
• Time slice : It’s the small portion of time given to each user to execute process.
Multi-tasking
• A task can be defined as an asynchronous code path within a process.
• A process can consist of multiple tasks, which can run simultaneously.
• In the same way that an multiuser operating system supports multiple processes at
the same time.
• The multiple tasks should be able to run concurrently within a process.
• Multitasking allows programmer flexibility and improves CPU utilization,
• consider a process consisting of two tasks.
• if task 0 is blocked, instead of blocking entire process,
Task 0 : Read a Record the operating system will find out whether task 1 can be
Process a Record. scheduled.
Task 0 end. • When both the tasks are blocked, only then the entire
Task 1 : Write a Record. process is blocked.
Task 1 end • Again even if one task is ready, the process can be
moved to ready list and then scheduled, this reduces
the overheads of context switching.
Time sharing
• The concept of time sharing was demonstrated as early as 1960.
• They provide Interactive use of computer.
• It uses CPU scheduling and multiprogramming to provide each user with a small
portion of time-shared computer.
• Each user has a separate program in memory.
• When the program executes, it executes for only short time before it either finishes
or needs to perform I/O.
• The operating system will rapidly switch the CPU to the program of some other user.
• A time shared operating system allows many users to simultaneously share the
Computer.
• Each action or command in time shared system tends to be short, only a Little CPU
time is needed for each user.
• As the system rapidly switches from one user to another, user are given impression
that they have their own computer, while actually one computer is shared among
many users.

You might also like