0% found this document useful (0 votes)
39 views10 pages

Question Bank Osy-1

Uploaded by

work4jeeshans
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views10 pages

Question Bank Osy-1

Uploaded by

work4jeeshans
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Sub: Operating System Sub code :22516

Question Bank

2 Marks question

What is operating system and list its functions


Operating System is collection of set of programs which manage all the resources of the
computer system
A O.s that acts as an intermediary between a user of a computer and the computer hardware.
Functions.Process Management ,Memory Management, Storage Management ,I/O
Management ,Device / Resource Management ,Security and Protection ,Data
communications

Define system call and list its types.


 System calls provide an interface between a user program and Operating System.
 These are set of functions methods. Most system calls are written in assembly
language and are machine dependent.
Types 1.process control 2. File Management3.Device Management 4.Information
Maintenance5.Communication

State Command Interpreter System


Command Interpreter System
A command interpreter is an interface of the operating system with the user. The user
gives commands with are executed by operating system (usually by turning them into
system calls). The main function of a command interpreter is to get and execute the
next user specified command. Command-Interpreter is usually not part of the kernel,
since multiple command interpreters (shell, in UNIX terminology) may be support by
an operating system, and they do not really need to run in kernel mode. There are two
main advantages to separating the command interpreter from the kernel.
1. If we want to change the way the command interpreter looks, i.e., I want to change the
interface of command interpreter, I am able to do that if the command interpreter is
separate from the kernel. I cannot change the code of the kernel so I cannot modify
the interface.
2. If the command interpreter is a part of the kernel it is possible for a malicious process
to gain access to certain part of the kernel that it showed not have to avoid this ugly
scenario it is advantageous to have the command interpreter separate from kernel.
Draw and state operating system components.
Ans. A computer system can be divided into four components:
1) The hardware.
2) The operating system
3) Application programs
4) The users

Computer System Components


1. Hardware – provides basic computing resources (CPU, memory, I/O devices).
2. Operating system – controls and coordinates the use of the hardware among the various
application
programs for the various users.
3. Applications programs – Define the ways in which the system resources are used to solve the
computing
problems of the users (compilers, database systems, video games, business programs).
3. Users (people, machines, other computers)

State Secondary-Storage Management


Generally speaking, systems have several levels of storage, including primary storage,
secondary storage and cache storage. Instructions and data must be placed in primary
storage or cache to be referenced by a running program. Because main memory is too
small to accommodate all data and programs, and its data are lost when power is lost,
the computer system must provide secondary storage to back up main memory.
Secondary storage consists of tapes, disks, and other media designed to hold
information that will eventually be accessed in primary storage (primary, secondary,
cache) is ordinarily divided into bytes or words consisting of a fixed number of bytes.
Each location in storage has an address; the set of all addresses available to a program
is called an address space.
The three major activities of an operating system in regard to secondary storage
management are:
1. Managing the free space available on the secondary-storage device.
2. Allocation of storage space when new files have to be written.
3. Scheduling the requests for memory access.

Write use of following system calls.

1) fork( )
2) exec( )
3) abort( )
4) end( )
Ans. Ans. 1. fork ( ) This system call is used to create a new process.
2. exec( ) This system call is used to replace the process’s memory space with anew program.
It loads a binary file into memory and starts its execution.
3. abort( ) This system call is used to halt process execution abnormally.
4. end ( ) This system call is used to halt process execution normally.

4 marks question

what is process and state its sections with diagram.


A process is a program in execution. Process is also called as job, task or unit of work.
The execution of a process must progress in a sequential fashion. Process is an active
entity.
Process memory is divided into four sections for efficient working :

 The Text section is made up of the compiled program code, read in from non-
volatile storage when the program is launched.
 The Data section is made up the global and static variables, allocated and initialized
prior to executing the main.
 The Heap is used for the dynamic memory allocation, and is managed via calls to
new, delete, malloc, free, etc.
 The Stack is used for local variables. Space on the stack is reserved for local
variables when they are declared.

Explain system call implementation with example.


The system call interface layer includes entrance point in kernel code. All system resources
are managed and controlled by the kernel. Any request from user or application that occupies
access to any system resource must be tackled by kernel code. The user process must not be
given entire access to kernel code for security cause. Many opening into kernel code called
system calls are provided to the user so that the user processes can raise the execution of
kernel code.
System calls permit processes and users to Operating System resources.

1. Each system call associated with a particular number.


2. System call interface maintains a table indexed according to these numbers.
3. The system call interface invokes intended system call in operating system kernel& returns
status of the system call and any return values.
4. The caller needs to know nothing about how the system call is implemented. Justneeds to
obey API and understand what OS will do as a result call.
5. Most details of operating system interface hidden from programmers by API. It ismanaged
by run-time support library.
 System calls provide the interface between a running program and the operating
system.
 For example – open input file, create output file, print message to console, terminate
with error or normally
 Generally available as routines written in C and C++
 Certain low-level tasks (direct hardware access) may be written in assembly-language
Example of System Calls.
System call sequence to copy the contents of one file to another file

Differentiate between multiprogramming and multitasking.

BASIS FOR MULTIPROGRAMMING MULTITASKING


COMPARISON

Basic Enables multiple programs to A supplementary form of the


utilize CPU simultaneously. multiprogramming system also supports
user interaction.

Objective Improvement in CPU utilization. Minimize the response time.

Switching Occurs when the currently running Carried out each time after the time slice
process stops. of process is finished.

Complexity Simple Complex

Draw and explain services of operating system


Following are the five services provided by operating systems
to the convenience of the users.
1. Program Execution
The purpose of computer system is to allow the users to execute programs in an efficient
manner. The operating system provides an environment where the user can conveniently run
these programs. The user does not have to worry about the memory allocation or de-
allocation or any other thing because these things are taken care of by the operating system.
To run a program, the program is required to be loaded into the RAM first and then to assign
CPU time for its execution. Operating system performs this function for the convenience of
the user. It also performs other important tasks like allocation and de-allocation of memory,
CPU scheduling etc.
2. I/O Operations
Each program requires an input and after processing the input submitted by user it produces
output. This involves the use of I/O devices. The operating system hides the user from all
these details of underlying hardware for the I/O. So the operating system makes the users
convenient to run programs by providing I/O functions. The I/O service cannot be provided
by user-level programs and it must be provided by the operating system.
3. File System Manipulation
While working on the computer, generally a user is required to manipulate various types of
files like as opening a file, saving a file and deleting a file from the storage disk. This is an
important task that is also performed by the operating system.
Thus operating system makes it easier for the user programs to accomplish their task by
providing the file system manipulation service. This service is performed by the 'Secondary
Storage Management' a part of the operating system.
4. Communication
Operating system performs the communication among various types of processes in the form
of shared memory. In multitasking environment, the processes need to communicate with
each other and to exchange their information. These processes are created under a
hierarchical structure where the main process is known as parent process and the sub
processes are known as child processes.
5. Error Detection
Operating system also deals with hardware problems. To avoid hardware problems the
operating system constantly monitors the system for detecting the errors and fixing these
errors (if found). The main function of operating system is to detect the errors like bad sectors
on hard disk, memory overflow and errors related to I/O devices. After detecting the errors,
operating system takes an appropriate action for consistent computing.
This service of error detection and error correction cannot be handled by user programs
because it involves monitoring the entire computing process. These tasks are too critical to be
handed over to the user programs. A user program, if given these privileges; can interfere
with the corresponding operation of the operating systems.
6. Resource allocation
In the multitasking environment, when multiple jobs are running at a time, it is the
responsibility of an operating system to allocate the required resources (like as CPU, main
memory, tape drive or secondary storage etc.) to each process for its better utilization. For
this purpose various types of algorithms are implemented such as process scheduling, CPU
scheduling, disk scheduling etc.
7. Accounting
Operating system keeps an account of all the resources accessed by each process or user. In
multitasking, accounting enhances the system performance with the allocation of resources to
each process ensuring the satisfaction to each process.
8. Protection System
If a computer system has multiple users and allows the concurrent execution of multiple
processes, then the various processes must be protected from one another's activities.
9. Accounting
This service of the operating system keeps track of which users are using how much and what
kinds of computer resources have been used for accounting or simply to accumulate usage
statistics.
10. Protection and Security
Protection includes in ensuring all access to system resources in a controlled manner. For
making a system secure, the user needs to authenticate him or her to the system before using
(usually via login ID and password).
What is process management? State for functions to be performed by OS for process
management.

A Program does nothing unless its instructions are executed by a CPU. A program in execution is
called a process.

There may exist more than one process in the system which may require the same resource at the
same time. Therefore, the operating system has to manage all the processes and the resources in a
convenient and efficient way.

Some resources may need to be executed by one process at one time to maintain the consistency
otherwise the system can become inconsistent and deadlock may occur.

The operating system is responsible for the following activities in connection with Process
Management

1. Scheduling processes and threads on the CPUs.

2. Creating and deleting both user and system processes.

3. Suspending and resuming processes.

4. Providing mechanisms for process synchronization.

5. Providing mechanisms for process communication.

Draw process state diagram and describe each state.

New: The process being created is available in the new state. It is the new state
because the system is not permitted it to enter the ready state due to limited
memory available in the ready queue. If some memory
becomes available, then the process from the new state will go to ready state.
Ready State: The process which is not waiting for any external event such as I/O
operation and which is not running is said to be in ready state. It is not in the
running state because some other process is already
running. It is waiting for its turn to go to the running state.
Running State: The process which is currently running and has control of the
CPU is known as the process in running state. In single user system, there is only
one process which is in the running state. In multiuser system, there are multiple
processes which are in the running state.
Blocked State: The process that is currently waiting for external event such as
an I/O operation is said to be in blocked state. After the completion of I/O
operation, the process from blocked state enters in the
ready state and from the ready state when the process turn will come it will
again go to running state.
Terminated State: The process whose operation is completed, it will go the
terminated state from the running state. In halted state, the memory occupied by
the process is released.

You might also like