OS QBank Unit 1
OS QBank Unit 1
An operating system is a program that manages the computer hardware. It also provides a basis
for application programs and act as an intermediary between a user of a computer and the
computer hardware. It controls and coordinates the use of the hardware among the various
application programs for the various users.
2. Why is the Operating System viewed as a resource allocator & control program?
A computer system has many resources – hardware & software that may be required to solve a
problem, like CPU time, memory space, file-storage space, I/O devices & so on. The OS acts as
a manager for these resources so it is viewed as a resource allocator.
The OS is viewed as a control program because it manages the execution of user programs to
prevent errors & improper use of the computer.
A more common definition is that the OS is the one program running at all times on the
computer, usually called the kernel, with all else being application programs.
Batch systems are quite appropriate for executing large jobs that need little interaction. The user
can submit jobs and return later for the results. It is not necessary to wait while the job is
processed. Operators batched together jobs with similar needs and ran them through the
computer as a group.
Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one
to execute. Several jobs are placed in the main memory and the processor is switched from job to
job as needed to keep several jobs advancing while keeping the peripheral devices in use.
Multiprogramming is the first instance where the Operating system must make decisions for the
users. Therefore they are fairly sophisticated.
Interactive computer system provides direct communication between the user and the system.
The user gives instructions to the operating system or to a program directly, using a keyboard or
mouse ,and waits for immediate results.
Multiprocessor systems also known as parallel systems or tightly coupled systems are systems
that have more than one processor in close communication, sharing the computer bus, the clock
and sometimes memory & peripheral devices. Their main advantages are
Increased throughput
Economy of scale
Increased reliability
Symmetric multiprocessing (SMP): In SMP each processor runs an identical copy of the Os &
these copies communicate with one another as needed. All processors are peers. Examples are
Windows NT, Solaris, Digital UNIX, OS/2 & Linux.
In multiprocessor systems, failure of one processor will not halt the system, but only slow it
down. If there are ten processors & if one fails the remaining nine processors pick up the work of
the failed processor. This ability to continue providing service is proportional to the surviving
hardware is called graceful degradation.
The dual mode operation provides us with the means for protecting the operating system from
wrong users and wrong users from one another. User mode and monitor mode are the two
modes. Monitor mode is also called supervisor mode, system mode or privileged mode. Mode bit
is attached to the hardware of the computer to indicate the current mode. Mode bit is ‘0’ for
monitor mode and ‘1’ for user mode.
Some of the machine instructions that may cause harm to a system are designated as privileged
instructions. The hardware allows the privileged instructions to be executed only in monitor
mode.
13. How can a user program disrupt the normal operations of a system?
The protection against illegal memory access is done by using two registers. The base register
and the limit register. The base register holds the smallest legal physical address; the limit
register contains the size of the range. The base and limit registers can be loaded only by the OS
using special privileged instructions.
Process management
Main-memory management
File management
I/O-system management
Secondary-storage management
Networking
Protection system
Command-interpreter system
It also includes the process stack, containing temporary data and a data section containing global
variables.
17. What is a process state and mention the various states of a process?
As a process executes, it changes state. The state of a process is defined in part by the current
activity of that process. Each process may be in one of the following states:
New
Running
Waiting
Ready
Terminated
Each process is represented in the operating system by a process control block also called a task
control block. It contains many pieces of information associated with a specific process. It
simply acts as a repository for any information that may vary from process to process.
Process state
Program counter
CPU registers
CPU-scheduling information
Memory-management information
Accounting information
19. What are the use of job queues, ready queues & device queues?
As a process enters a system, they are put into a job queue. This queue consists of all jobs in the
system. The processes that are residing in main memory and are ready & waiting to execute are
kept on a list called ready queue. The list of processes waiting for a particular I/O device is kept
in the device queue.
Switching the CPU to another process requires saving the state of the old process and loading the
saved state for the new process. This task is known as context switch. The context of a process is
represented in the PCB of a process.
System calls provide the interface between a process and the Operating system. System Calls are
also called as Monitor call or Operating-system function call. When a system call is executed, it
is treated as by the hardware as software interrupt. Control passes through the interrupt vector to
a service routine in the operating system, and the mode bit is set to monitor mode.
• Program execution
• I/O Operation
• File-System manipulation
• Communications
• Error detection
25.What is the difference between Hard real time system and Soft real time system?
A hard real time system guarantees that critical tasks complete on time. In a soft real time
system, a critical real-time task gets priority over the other tasks, and retains that priority until it
completes. Soft real time systems have more limited utility than do hard real-time systems.
The operating system picks and begins to execute one of the jobs in the memory. Eventually, the
job may have to wait for some task, such as a tape to be mounted, or an I/O operation to
complete. In a non-multiprogrammed system, the CPU would sit idle. In a multiprogramming
system, the operating system simply switches to and executes another job. When that job needs
to wait, the CPU is switched to another job, and so on. Eventually, the first job finishes waiting
and gets the CPU back. As long as there is always some job to execute, the CPU will never be
idle.
The requirements can be divided into two basic groups: User goals and System goals. Users
desire that the system should be convenient and easy to use, easy to learn, reliable, safe and fast.
The Operating system should be easy to design, implement, and maintain. Also it should be
flexible, reliable, error free and efficient. These are some of the requirements, which are vague
and have no general solution.
• Process Control
• File-management
• Device-management
• Information maintenance
• Communications
Fork is a System calls by which a new process is created. Execve is also a System call, which is
used after a fork by one of the two processes to replace the process memory space with a new
program.
Maximum CPU Time: Maximum amount of CPU time a process may use.