Download Operating System Concepts

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Library (computing) wikipedia , lookup

Unix security wikipedia , lookup

Distributed operating system wikipedia , lookup

DNIX wikipedia , lookup

Burroughs MCP wikipedia , lookup

Process management (computing) wikipedia , lookup

Transcript
Operating System Concepts
Chapter 3
Today’s Agenda
• Review of previous concepts
• Processes Concept (Introduction)
• Discussion
on
Process
features
(scheduling, creation, termination and
communication)
• Communication in client-server systems
Chapter 3 (Processes)
Summary of previous concepts:
A computer consists of a collection of hardware
resources, such as the processor, main memory, I/O
devices and so on.
Computer applications are developed to perform some
task. Typically, they accept input from the outside
world, perform some processing, and generate
output.
Software is needed to manage the sharing of the
processor and other resources by multiple applications
at the same time.
When multiple applications are active at the same time, it is
necessary to protect the data, I/O device access, and other resource
use of each application from the rest.
The OS was developed to provide a convenient, feature-rich,
secure, and consistent interface for applications to use. The OS is
a layer of software between the user applications and the computer
hardware that supports applications
Process Concept
• A process is a program in execution
• OS books uses the terms job and process almost
interchangeably.
• Concurrent processing increases system performance
• A process is an active entity, that has its own address
space
Address space (range of memory addresses reserved for a
process), it consists of
– program counter (current activity/ address of the next
instruction in the program to be executed.
– Text section (program code- the code which processor
executes)
– Stack (contains temporary data such as function parameters,
return addresses, and local variables)
– data section (contains global variables)
Program VS Process
• We emphasize that a program by itself is not a process; a
program is a passive entity, such as a file containing a list of
instructions stored on disk (often called an executable file),
whereas a process is an active entity, with a program
counter specifying the next instruction to execute and a set
of associated resources. A program becomes a process
when an executable file is loaded into memory.
• Two common techniques for loading executable files are
double-clicking an icon representing the executable file
and entering the name of the executable file on the
command line (as in prog. exe or a. out.)
Difference between a Process and a Program
Process State
OS must ensure that each process receives a sufficient
amount of processor time
A process moves through a series of states during its
lifetime
Various things causes a process to change its state
As a process executes, it changes state:
– New: Process is being created
– Ready: runnable (ready in main memory to get processor
time)
– Running: Instructions are being executed (actually using the
CPU)
– Waiting: The process is waiting for some external event to
occur or waiting for an input that is not yet available
– Terminated: The process has finished execution
Diagram of Process State
Process Attributes
What are process attributes and why is it necessary to
associate certain attributes with a process ?
Identification…. ?
If a processor is executing only one program, then NO
ALL JOY…
If I have only one CPU in my system, then how I cheat
or give an illusion of multiple things ‘going on’ ?
Time-sharing systems and multiprogramming
systems
processor is able to service multiple programs
Process Control Block
• Attributes should include ‘everything a process
cares about’ !
 Process State- (running, ready etc)
 Program Counter- (address of the next instruction
in the program to be executed)
 CPU registers (State of CPU registers- Data
present in registers in processor while the
process is executing)
 CPU scheduling priority- (priority relative to other
processes, information about scheduling
queues)
 Memory Management Information (location of
process’s data and instructions in memory,
value of base and limit registers)
 Accounting Information (includes amount
processor time used, process number)
of
 I/O status information (data that determines the
resources this process can access such as list
of I/O devices, files etc)
 This block of information is maintained by OS and
created for every process, also known as ‘Process
Descriptor’
CPU Switch From Process to Process
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
Device queues – set of processes waiting for an I/O
device
Process migrates between the various queues throughout
its lifetime
Queuing diagram represents process scheduling
Events to occur are:
 I/O request
 Creation of a subprocess (parent process creates a child process
and waiting for it to complete)
 Time-slice expire
Representation of Process Scheduling
Schedulers
 The job of a scheduler is to select process from
various queues
 Long-term scheduler (or job scheduler) –
selects which processes should be brought into
the main-memory
 Short-term scheduler (or CPU scheduler) –
selects which process should be executed next
and allocates CPU
 CPU Scheduler:
 Is invoked very frequently
 Must be very fast
 Process scheduling wastes some time of CPU
Schedulers
 Long-Term Scheduler:




Is invoked very infrequently
Controls the degree of multiprogramming
Can afford to take more time to select a process for execution
Must select a good process-mix of I/O-bound and CPU-bound
processes
 Medium-Term Scheduler: (also known as SWAPPER)
 Is available in time-sharing systems
 Carries out swapping-in or swapping-out to improve the process-
mix and compensate for change in memory requirements
 E.g. a running process indicates that it needs more space, if the
required space is not available, then that process will be swapped
out to SWAP SPACE temporarily
 REGULARIZE the process execution by swapping out the BIASED
processes
Addition of Medium Term Scheduling
Context Switch
 When CPU switches to another process, the system must





save the state of the old process and load the saved state
for the new process --- context-switch.
Context-switch time is overhead; the system does no
useful work while switching.
Context-switching speed varies from machine to machine
(depends upon memory speed, number of registers to be
copied, existence of special instructions).
Context-switch times are highly dependent on hardware
support.
Short term scheduler selects a program from ready queue
and tells the DISPATCHER to execute this program.
DISPATCHER- a small program in OS which PULLS OUT
the processor from one process and give to another
Context Switch Overhead
No useful work… Alas !