Operating System (3439)
Operating System (3439)
ASSIGNMENT No. 1
Q. 1 What is meant by an Operating System? Also explain the main purpose of an Operating
System with the help of examples.
Operating System
Overview:
When a brand new computer comes off the factory assembly line, it can do nothing. The
hardware needs software to make it work. Are we talking about applications software
such as word processing or spreadsheet software? Partly.
But an applications software package does not communicate directly with the hardware.
As shown in Figure 1, between the applications software and the hardware is a software
interface - an operating system.
3. Peripheral Controlling
Every devices of the computer have own device driver that is piece of the
programming code. These types of the drivers create the interface in between
operating system and devices, and operating system having the all control of
drivers . All drivers execute on the kernel region of the operating system, and
device drivers have many rights such as Open, Close, Read, Write, and more.
Q. 2 (a) Define the term "Process" with the help of suitable examples.
Process (Computing)
In computing, a process is the instance of a computer program that is being executed
by one or many threads. It contains the program code and its activity. Depending on
the operating system (OS), a process may be made up of multiple threads of
execution that execute instructions concurrently.
While a computer program is a passive collection of instructions, a process is the
actual execution of those instructions. Several processes may be associated with the
same program; for example, opening up several instances of the same program often
results in more than one process being executed.
Multitasking is a method to allow multiple processes to share processors (CPUs) and
other system resources. Each CPU (core) executes a single task at a time. However,
multitasking allows each processor to switch between tasks that are being executed
without having to wait for each task to finish (preemption). Depending on the
operating system implementation, switches could be performed when tasks initiate
and wait for completion of input/output operations, when a task voluntarily yields the
CPU, on hardware interrupts, and when the operating system scheduler decides that a
process has expired its fair share of CPU time (e.g, by the Completely Fair
Scheduler of the Linux kernel).
A common form of multitasking is provided by CPU's time-sharing that is a method
for interleaving the execution of users processes and threads, and even of
independent kernel tasks - although the latter feature is feasible only in
preemptive kernels such as Linux. Preemption has an important side effect for
interactive process that are given higher priority with respect to CPU bound
processes, therefore users are immediately assigned computing resources at the
simple pressing of a key or when moving a mouse. Furthermore, applications like
video and music reproduction are given some kind of real-time priority, preempting
any other lower priority process. In time-sharing systems, context switches are
performed rapidly, which makes it seem like multiple processes are being executed
simultaneously on the same processor. This simultaneous execution of multiple
processes is called concurrency.
For security and reliability, most modern operating systems prevent
direct communication between independent processes, providing strictly mediated
and controlled inter-process communication functionality. It's the main chip in a
computer it processes instruction, performs calculations, and manages flow of
information through a computer system it communicates with input, output, and
storage systems to perform task.
Q2 (b) Why Inter Process Communication is needed in an operating system? Explain it in
detail.
Deadlock
In concurrent computing, a deadlock is a state in which each member of a group
waiting for another member, including itself, to take action, such as sending a
message or more commonly releasing a lock. Deadlock is a common problem in
multiprocessing systems, parallel computing, and distributed systems, where
software and hardware locks are used to arbitrate shared resources and
implement process synchronization.
Detection
Under the deadlock detection, deadlocks are allowed to occur. Then the state of the
system is examined to detect that a deadlock has occurred and subsequently it is
corrected. An algorithm is employed that tracks resource allocation and process
states, it rolls back and restarts one or more of the processes in order to remove the
detected deadlock. Detecting a deadlock that has already occurred is easily possible
since the resources that each process has locked and/or currently requested are
known to the resource scheduler of the operating system.
After a deadlock is detected, it can be corrected by using one of the following
methods:
Necessary Conditions
A deadlock situation on a resource can arise if and only if all of the following
conditions hold simultaneously in a system:[5]
3. Job Accounting:
Operating system Keeps track of time and resources used by various tasks and
users, this information can be used to track resource usage for a particular user or
group of user.
6. Memory Management:
The operating system manages the Primary Memory or Main Memory. Main
memory is made up of a large array of bytes or words where each byte or word is
assigned a certain address. Main memory is a fast storage and it can be accessed
directly by the CPU. For a program to be executed, it should be first loaded in the
main memory. An Operating System performs the following activities for memory
management.
It keeps tracks of primary memory, i.e., which bytes of memory are used by which
user program. The memory addresses that have already been allocated and the
memory addresses of the memory that has not yet been used. In multi programming,
the OS decides the order in which process are granted access to memory, and for how
long. It Allocates the memory to a process when the process requests it and
deallocates the memory when the process has terminated or is performing an I/O
operation.
7. Processor Management:
In a multi programming environment, the OS decides the order in which processes
have access to the processor, and how much processing time each process has. This
function of OS is called process scheduling. An Operating System performs the
following activities for processor management.
Keep tracks of the status of processes. The program which performs this task is
known as traffic controller. Allocate the CPU that is processor to a process. De-
allocate processor when a process is no more required.
8. Device Management:
An OS manages device communication via their respective drivers. It performs the
following activities for device management. Keeps tracks of all devices connected to
system. Designate a program responsible for every device known as the input/output
controller. Decides which process gets access to a certain device and for how long.
Allocate devices in an effective and efficient way. Deallocate devices when they are
no longer required.
9. File Management:
A file system is organized into directories for efficient or easy navigation and usage.
These directories may contain other directories and other files. An Operating System
carries out the following file management activities. It keeps track of where
information is stored, user access settings and status of every file and more… These
facilities are collectively known as the file system.
Q. 5 Write short notes on the following topics:
Resources
The main job of an operating system is to allocate and manage the resource. For
example, if there are multiple programs running on my computer, its the job of my
operating system to provide the resources to program. Now this allocation can be of
two types:
Also examples of hardware resources are: CPU, Memory, I/O devices, Registers,
Cache and examples of Software resources are: Device Drivers, Semaphores,
Monitors(“This is not the display monitor”).