Transcript Processes

Last Week




Introduced operating systems
Discussed the Kernel
Discussed the Shell
Discussed single and multi-tasking systems
Processes




Introduce the idea of processes
Process states
Communication between processes
Process scheduling

Just for two minutes-apart from the program
code what other information do you think you
need to carry out the operation a program in a
multitasking operating system?

A process consists usually of:
–
–
–

an executable program,
the data associated with the program,
execution context.
The execution context includes the processor
context (see last weeks notes), but also
information such as the process identifier,
priority level, and a process state

Process is in one of three states
–
–
–
Running
Ready
Blocked


When a process is in the running state, the
processor is executing the program code.
If a timer interrupt occurs (Time-out on
previous slide),
–
–
the running process is moved into ready state
another process from the list of processes in the
ready state is moved into the running state.

If a process in the running state requests an
operating system service and it must wait for it,
then the process is moved into the blocked
state.


A process will remain in the blocked state until
the event required has taken place, the
process can then be moved back into the
ready state.
If a process is blocked the operating system is
free to schedule another process.
Process Scheduling
• A simple approach is the Round robin
• Each process is forced to release control when
its time is up. Sometimes called pre-emptive
scheduling.
Interprocess communication

A process sometimes needs to communicate
with one or more other processes
–

For example, when competing for shared resources
or co-operating on joint tasks.
The aim for a process to get sole control of a
resource (mutual exclusion) when it needs it.
Mutual Exclusion



Operating systems manages resources.
A resource is pre-emptable if ownership of the
resources can be taken away from one
process, and pass to another.
In other words if taking ownership is not critical
to the process
Mutual Exclusion


If this is not true, resource is critical. Mutual
exclusion is concerned with ensuring that at
any time, there is not more than one process in
its critical section of its program code.
Signalling between competing processes is
needed.
Synchronisation

Two processes needing co-ordinating their
actions. For example, if two processes share a
buffer in which one puts information in and the
other removes data. Steps must taken to
prevent a process removing data when the
buffer is empty, or putting data into a buffer
when it is full

One approach is to use flags indicating when a
resources is available.

A process checks the flag for a resource, if flag
is not set, process sets the flag and uses the
resource. A second process sees the flag is set
and is in effect ‘locked-out’ until the flag is set.
When the first process finishes with the resource
the flag is reset.
What are the key-points
Name at least four points, that you feel
summarise the material in this session.
Can you summarises some of these points in the
form of diagrams?