OS - Scheme-1
OS - Scheme-1
OS - Scheme-1
Marks
Q.No Solution
Allocated
5M
Q1. Multiprocessor systems and clustered systems: Multiprocessor systems (also known as
parallel systems or tightly coupled systems) are growing in importance. Such systems have 5M
two or more processors in close communication, sharing the computer bus and sometimes
the clock, memory, and peripheral devices.
Clustered systems differ from multiprocessor systems, however, in that they are composed
of two or more individual systems coupled together. Clustering is usually used to provide
high-availability service; that is, service will continue even if one or more systems in the
cluster fail. High availability is generally obtained by adding a level of redundancy in the
system.
To completely understand the role of operating system, two views are considered:
1. User View: The user view of the computer depends on the interface used. Some users may
use PC’s. Such system is designed for one user. Here the OS is designed for ease of use where
some attention is mainly on performances and not on the resource utilization.
may access the same computer through other terminals. These users may share resources and
exchange information. In this case the OS is designed to maximize resource utilization – so
that all available CPU time, memory & I/O are used efficiently.
servers, then the user have a system unit of their own and shares resources and files with other
systems. In this case OS is designed to compromise between individual usability & resource
utilization.
SJCIT
A computer system has many resources such as CPU Time, memory space, file storage space,
I/O devices and so on that may be used to solve a problem.
programs and the users so that it can operate the computer system efficiently and fairly.
is a control program which manages the execution of user programs to prevent errors and
improper use of the computer.
2. Define a virtual machine (VM) .With a neat diagram, explain the working of a virtual
machine and give its benefits.
The fundamental idea behind a virtual machine is to abstract the hardware of a single
computer (the CPU, memory, disk drives, network interface cards, and so on) into several
different execution environments, thereby creating the illusion that each separate execution
environment is running its own private computer. By using CPU scheduling and virtual-
memory techniques, an operating system can create the illusion that a process has its own
processor with its own (virtual) memory. Each process is provided with a (virtual) copy of the
underlying computer as shown in the below figure.
A major difficulty with the virtual machine approach involves disk systems. Suppose that the 10M
physical machine had three disk drives but wanted to support seven virtual machines. Clearly,
it could not allocate a disk drive to each virtual machine, because the virtual machine software
SJCIT
itself will need substantial disk space to provide virtual memory and spooling. The solution is
to provide virtual disks-termed mini disks in IBM's VM operating system which are identical
in all respects except size.
Benefits
Process Execution Must guarantee timely task Nodes work together for load
completion. balancing.
3M
Resource Management Prioritizes tasks based on Manages resources across
timing requirements. multiple machines.
4M
•The producer can produce one item while the consumer is consuming another item.
The producer and consumer must be synchronized, so that the consumer does not try
to consume an item that has not yet been produced by the producer.
Two types of buffers can be used.
Unbounded-buffer: places no practical limit on the size of the buffer. The consumer may
have to wait for new items, but the producer can always produce new items.
Bounded-buffer: assumes that there is a fixed buffer size, so the consumer must wait if the
buffer is empty, and the producer must wait if the buffer is full.
o Send (message)
o Receive (message)
Processes that want to communicate must have a way to refer to each other. They can
use either direct or indirect communication.
o Links are established automatically between every pair of processes that want to
communicate.
addressing,
o Symmetry: Both sender and receiver must name the other to communicate.
o Asymmetry: Only the sender names the recipient, the recipient is not required to
name the sender. The send() and receive() primitives are defined as,
Receive (id, message) – receive a message from any process; the variable id is set to the
name of the process with which communication has taken place.
A mailbox can be viewed abstractly as an object into which messages can be placed by
processes and from which messages can be removed.
Each mailbox has a unique id and processes can communicate only if they share a mailbox.
o destroy a mailbox
Synchronization
o Blocking send: The sending process is blocked until the message is received by the
receiving process or by the mailbox.
o Non-blocking send: The sending process sends the message and resumes operation.
1. Zero capacity – Maximum length is zero and sender must wait for the receiver.
2. Bounded capacity – finite length ofn messages, sender must wait if link is full.
What are system calls? With examples mention different types of system
calls and also demonstrate system calls for copying contents from one file to
another file.
System calls are the fundamental interface between an application and the operating system.
They allow user-space applications to request services from the operating system kernel,
such as file operations, process control, and network communication. System calls provide a
controlled way for programs to interact with the hardware and the OS without compromising
system stability and security. An interface provided by the system to the services made
available by an OS is called “System Call”.
Ex: end, abort, load, execute, create process, terminate process, wait for time, get process
attributes, set process attributes, wait event, signal event, allocate and free memory.
ii) File management: These programs create, delete, copy, rename, print, dump, list,
and generally manipulate files and directories.
Ex: create file, delete file, open, close, read, write, reposition, get file attributes, set file
attributes.
Ex: request device, release device, read, write, reposition, get device attributes, set device
attributes, logically attach or detach devices.
v) Information management: Get or set system information.
Ex: get time or date, set time or date, get system data, set system data, get process, file or
device attributes, set process, file or device attributes
v) Communications: These programs provide the mechanism for creating virtual connections
among processes, users, and computer systems. They allow users to send messages to one
another's screen, to browse web pages, to send electronic- mail messages, to log in remotely,
or to transfer files from one machine to another.
Ex: create, delete communication connection, send, receive messages, transfer status
information, attach or detach remote devices.
System call sequence to read the contents of one file and copy to another file is illustrated in
below figure shown below:
file fails, it should display error message on console (another system call) and should terminate
abnormally (another system call).
e program must create the output file (another system call), If fails, it should
display error message on console (another system call) and should also abort (another system
call).
Illustrate dual mode operation of operating system with neat block diagram
To ensure proper execution of the OS, we must be able to distinguish between OS code and
user defined code. Most computer systems provide hardware support to differentiate among
various modes of execution.
1. User mode
2. Kernel mode (also called supervisor, system or privileged mode)
Mode bit is added to the hardware to indicate current mode: User mode (1) and
Kernel mode (0).
When system is executing on behalf of user application, it is in user mode.
Q6. When an user application requests a service from OS, it must transit from
user to kernel mode to fulfill the request as shown in figure.
Transition from user to kernel mode: At system boot time, the hardware starts in
kernel mode. The OS is then loaded and starts user applications in user mode. Whenever
a trap or interrupt occurs, the hardware switches from user mode to kernel mode.
Thus whenever the OS gains control of the computer, it is in kernel mode. The system
always switches to user mode before passing control to user program.
2M
8M
Process Creation
A process may create several new processes by some create-process system call, during
the course of execution.
The creating process is called parent process and the created one is called the child
SJCIT
process. Each of the new process may in turn create other processes, forming a tree of
SJCIT
Below Figure. shows the process tree for the solaris OS. The process at the top of the
tree is sched process, with pid of 0,and this creates several children processes. The sched
process creates several children processes including pageout and fsflush. These
processes are responsible for managing memory and file systems. The sched process also
creates the init process, which serves as the root parent process for all user processes.
These processes are responsible for managing memory and file systems.
inetd and dtlogin are two children of init where inetd is responsible for networking
services such as telnet and ftp; dtlogin is the process representing a user login screen.
When a user logs in, dtlogin creates an X-windows session (Xsession), which in turns 10M
creates the sdt_shel process. Below sdt_shel, a user's command-line shell, the C-shell or
csh is created. In this command line interface, the user can then invoke various child
processes, such as the ls and cat commands.
There is also csh process with pid of 7778 representing a user who has logged onto the
system using telnet. This user has started the Netscape browser (pid of 7785) and the
emacs editor (pid of 8105).
A process needs certain resources to accomplish its task. Along with the various logical
and physical resources that a process obtains when it is created, initialization data may
be passed along by the parent process to the child process.
When a process creates a new process, two possibilities exist in terms of execution.
2. The parent waits until some or all of the children have terminated.
There are also two possibilities in terms of the address space of the new process.
In UNIX OS, fork () system call creates new process. In windows Create Process() does
the job.
Exec () system call is called after a fork () to replace the process memory space with a
new program.
3M
SJCIT
If there are two different processes running a copy of the same program, the pid for
child is zero and for the parent it is greater than zero. The parent process waits for the
child process to complete with the wait () system call.
When the child process completes, the parent process resumes from the call to wait(),
where it completes using exit() system call. This is shown in below figure.
Process Termination
A process terminates when it finishes executing its last statement and asks the operating
system to delete it by using exit() system call.
Process resources are deallocated by the operating system. A process can terminate
another process via Terminate Process() system call. A Parent may terminate
execution of children processes (abort) for the following reasons.
o If parent is exiting some operating system do not allow child to continue if its parent
terminates.
Some systems does not allow child to exist if its parent has terminated. If process
terminates then all its children must also be terminated, this phenomenon is referred as
cascading termination.
Generalize the concept process state diagram and PCB with a neat block
diagram.
5M
Q8.
SJCIT
The PCB contains important information about the specific process including,
o Process state: The current state of the process i.e., whether it is ready, running, waiting,
halted and so on.
o Program counter: Indicates the address of the next instruction to be executed for a process.
o CPU registers: The registers vary in number and type. Along with program counter this
state information should be saved to allow process to be continued correctly after an interrupt
occurs as shown in below figure.
o Memory-management information: This information may include the value of base and
limit registers, the page tables, or the segment tables, depending on the memory system used
by the OS.
o Accounting information: This information includes the amount of CPU and real time used,
time limits, account numbers, job or process numbers, and so on.
o I/O status information: This information includes the list of I/O devices allocated to the
process, a list of open files, and so on.
5M
• This model is efficient as the thread management is done by the thread library in user
space, but the entire process will block if a thread makes a blocking system call.
Q9
• As only one thread can access the kernel thread at a time, multiple threads are unable
to run in parallel on multiprocessors.
• Examples: Solaris Green Threads, GNU Portable Threads.
10M
Many-to-Many Model: One-to-One model restricts creating more user threads and Many-to-
One model allows creating more user threads but kernel can schedule only one thread at a
time.
Discuss the operating system services and also summarize the various categories
of system programs.
An OS provides an environment for the execution of the programs. The common services
provided by the OS are
1. User interface: Almost all operating systems have a user interface (UI).This interface can
take several forms.
a. Command-Line interface (CLI): uses text commands and a specific method for entering
them.
Q10. b. Batch Interface: commands and directives to control are entered into files and those files are
executed.
10M
c. Graphical User Interface (GUI): most common. Interface is a window system with a
pointing device directing the I/O, choose from menus, make selections along with keyboard to
enter text.
2. Program Execution: The OS must able to load the program into memory & run that
program. The program must be able to end its execution either normally or abnormally.
SJCIT
3. I/O Operation: A running program may require I/O( file or an I/O device). Users cannot
control the I/O devices directly. So the OS must provide a means for controlling I/O devices.
4. File System manipulation: Program needs to read and write files and directories. They also
need to create and delete files, search for a given file and list file information. Some programs
include permission management to deny access to files or directories based on file ownership.
5. Communication: In certain situation one process may need to exchange information with
another process. This communication may takes place in two ways.
ii.Between the processes executing on different computer that are connected by a network.
6. Error Detection: Errors may occur in CPU, I/O devices or in Memory Hardware. The OS
constantly needs to be aware of possible errors. For each type of errors the OS should take
appropriate actions to ensure correct & consistent computing.
7. Resource Allocation: When multiple users logs onto the system or when multiple jobs are
running, resources must be allocated to each of them. The OS manages different types of OS
resources. Some resources may need some special allocation codes & others may have some
general request & release code.
8. Accounting: We need to keep track of which users use how many & what kind of resources.
This record keeping may be used for accounting. This accounting data may be used for
statistics or billing. It can also be used to improve system efficiency.
9. Protection and security: Protection ensures that all the access to the system are controlled.
Security starts with each user having authenticated to the system, usually by means of a
password. External I/O devices must also be protected from invalid access. In multi process
environment it is possible that one process may interface with the other or with the OS, so
protection is required.