This relates to the Operating System’s activity of managing
the processor in the system, i.e. allocating and de-allocating of the processor
to the process. The Operating System decides the same based on the priority of
the process depending if there exists any and certain pre-defined algorithms. The
following section explains some related terminologies.
Process
A process may be defined as the running instance of a
program characterized by a change of state and attributes. Each and every
process maintains a Process Control Block or PCB of its own.
Process Control Block
A process control block (PCB) is a data structure that
contains information related to a running process. These include:
·
Process ID
·
Processor Information
·
Process State
·
Process Priority
·
Stack information
·
Memory information at which the process has been loaded
Process States
A process changes its state from one state to another
depending on its required activity. The process can be in one of the following
states.
·
Ready
·
Running
·
Suspended
Thread
A thread is a light weight process. It is the smallest unit
of CPU utilization and is also the path of execution within a process. A task
is an enhanced form of a thread. Each and every process should have at least
one thread; this is the primary or the main thread of the application. All
other user created threads run in the background and are also called worker
threads. When the application’s main thread terminates so does the
application.
User Level Threads
The User Level threads are those that are executed in the
User’s memory context and do not make use of System calls. Therefore, Kernel
switching does not occur in User Level threads.
Kernel Level Threads
The Kernel Level threads are those that are executed in the
Operating System’s Kernel memory context. The threads are managed and
controlled by the Kernel using System calls.
Inter Process Communication
This refers to the communication between two or more
processes for the purpose of data and message transfer.
Multithreading
Multithreading is the ability of the operating system to
have at the same of time multiple threads in memory that switch between the
tasks. This is to provide a pseudo parallelism, as if all the tasks are
running simultaneously. This illusion of concurrency is ensured by the
Operating System by providing a specific time slice to each and every thread
and then switching between the threads very fast once their slice is over.
Multithreading can be of the following types.
·
Serial
·
Cooperative
·
Preemptive
In the serial mode of multithreading a thread is executed by
the Operating System and until the execution of that thread is over, any other
thread cannot be executed. Hence, a thread has to wait until the earlier
thread's turnaround time is over. In other words, the currently executing
thread monopolizes the processor. In the Cooperative mode of multithreading, a
thread can have the control of the processor as long as it needs without the need
to necessarily preempt them. In order words, in this type of multithreading
the control of the processor lies with the executing thread. In the preemptive
mode of operation however, the operating system has control over the processor
and decides the time slice for each thread for which it would execute and
preempt threads if and when required. Serial Multithreading is supported by the
MS DOS operating system, cooperative multithreading is supported by Windows
3.11, while preemptive mode is supported by Windows 98, NT.
Thread Priorities
Thread priorities are values that can be set to distinguish
one thread from another depending on their priorities. A thread with a higher
priority would execute more frequently than a thread having a comparatively
less priority.
Multitasking
A task is an enhanced form of a thread. Multitasking is the
logical extension of multiprogramming. The following list shows the names of
some commonly used Operating Systems and the type of multitasking that they
support.
·
DOS : Serial Multitasking
·
Win 3.11 : Co-operative Multitasking
·
Win 9x/NT : Preemptive Multitasking
·
UNIX : Time Sliced Priority Based
Multitasking
Multiprocessing
Multiprocessing or parallel processing refers to multitasking
on multiple processors. It is of the following two types.
·
Symmetric
·
Asymmetric