OSY MSBTE CHP2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Chapter 2 (10M)

1. List Components of OS. Explain Process Management in detail


Ans. List of System Components:

• Process management
• Main memory management
• File management
• I/O system management
• Secondary storage management

Process Management: The operating system manages many kinds of


activities ranging from user programs to system programs like printer spooler,
name servers, file server etc. Each of these activities is encapsulated in a
process.
1. A process includes the complete execution context (code, data, PC,
registers, OS resources in use etc.).
2. The basic unit of software that the operating system deals with in
scheduling the work done by the processor is either a process or a thread,
depending on the operating system.
3. It’s tempting to think of a process as an application, but that gives an
incomplete picture of how processes relate to the operating system and
hardware.
4. The application you see (word processor or spreadsheet or game) is,
indeed, a process, but that application may cause several other processes
to begin, for tasks like communications with other devices or other
computers.
2. Describe any 2 components of OS

Ans. List of System Components:

1. Process management
2. Main memory management
3. File management
4. I/O system management
5. Secondary storage management

1.Process Management:

A program is a set of instructions. When CPU is allocated to a Jprogram, it can start its
execution. A program in execution is a process. A word processing program run by a
user on a PC is a process. A process needs various system resources including CPU
time, memory, files and I/O devices to complete the job execution. These resources can
be given to the process when it is created or allocated to it while it is running. The
operating system responsible for the following activities in Connection with process
management:

• Creation and deletion of user and system processes.


• Suspension and resumption of processes.
• A mechanism for process synchronization.
• A mechanism for process communication.
• A mechanism for deadlock handling.

2. I/O device Management:

Input / Output device management provides an environment for the better interaction
between system and the I / O device. To interact with I/O devices in an effective manner,
the operating system uses some special programs known as device driver. The device
drivers take the data that operating system has defined as a file and then translate them
into streams of bits or a series of laser pulses.

The I/O subsystem consists of several components:

• A memory management component that includes buffering, caching, spooling


• A general device driver interface
• Drivers for specific hardware devices
3. What is the purpose of System call ? State any 2 system call and explain
their functions ?
Ans. System call provides an interface between a running program and
operating system. It allows user to access services provided by operating
system. This system calls are procedures written using C, C++ and assembly
language instructions. Each operating system has its own name for each
system call. Each system call is associated with a number that identifies
itself.
System calls:

Process Control: Program in execution is a process. A process to be executed


must be loaded in main memory. while executing it may need to wait,
terminate or create & terminate child processes.

• end, abort
• load, execute
• create process, terminate process
• wait for time
• wait event, signal event
• allocate and free memory

Device Management: When a process is in running state, it requires several


resources to execute. These resources include main memory, disk drives, files
and so on. If the resource is available, it is assigned to the process. Once the
resource is allocated to the process, process can read, write and reposition
the device.

• request device, release device


• read, write, reposition
• get device attributes, set device attributes
• logically attach or detach devices
4. List and describe any 4 services of OS
Ans.
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
2. I/O Management: 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.
3. 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.
4. 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.

5. Write any four systems call related to file management


Ans. System calls related to file management are:
1. create new file

2. delete existing file


3. open file
4. close file
5. create directories. 6. delete directories
6. Write down the responsibilities of the following components of OS

I. Memory Management
II. File Management

Ans. i) Memory Management:

• Keeping track of which parts of memory are currently being used and by whom.
• Allocating and deallocating memory space as needed.
• Managing swap spaces, which store inactive pages of memory.
• Implementing policies for memory allocation.

ii) File Management:

• The creation and deletion of files.


• The creation and deletion of directory
• The support of primitives for manipulating files and directions.
• The mapping of files onto secondary storage.

7. Explain any four types of system call

Ans. 1. Process control

• A process or job executing one program may want to load and execute another
program. This allows the control card interpreter to execute program as directly by the
control cards of the user job. If we create a new job or process, we should able to
control its execution.
• We may also want to terminate a job or process that we created (terminate process). If
we find that it is incorrect or no longer needed we need waiting time to finish execution
(wait time). Another set of system calls are helpful in debugging a program

Example of Process related system call:

a. End, Abort

b. Load, Execute

c. Create process, Terminate process.

d. Ready process, Dispatch process.

2.File Management
• We can identify several common system calls dealing with files. We first need to be able
to create and delete files such a system call requires the name of the file and perhaps
some of its attributes.
• Once, the file is created, we need to open it and use it. We may also read, write and
reposition. Finally we need to close the file, indicating that we are no longer using it.

Example of file related system call:

a. Create file, Delete file

b. Open a file, Close a file.

c. Create directory.

d. Read, Write, Reposition

3. Information Maintenance

• Many system calls exist simply for the purpose of transferring information between the
user program and the operating system. For example most systems have a system call
to return the current time and date.
• In addition the operating system keeps information about all of its Jobs and processes
and there are system calls to access this Information. Generally, there are also calls to
reset it.

Information Maintenance related system call:

a. Get Time or Date, Set Time or Date.


b. Get system Data, Set system Data.
c. Get process, File or Device attributes.
d. Set process, File or Device attributes.

4. Communication

• Message-passing uses a common mailbox to pass messages between processes


• Shared memory use certain system calls to create and gain access to regions of
memory owned by other processes

Communication related system calls:

a. Establish a connection.

b. Send, receive messages.

c. Terminate a connection
1. *Enlist the operating system tools. Explain any two in detail

Ans. Following are the operating tools:

• User Management
• Security policy
• Device Management
• Performance Monitor
• Task Scheduler

A) User management:

I. User management includes everything from creating a user to Deleting a user on your
system. User management can be done In three ways on a Linux system.
II. Command line tools include commands like useradd, userdel, Usermod, passwd, etc.
These are mostly used by the server Administrators.

Useradd: With useradd commands you can add a user.

Syntax: useradd -m -d /home/<userName> -

c "<userName>" <userName>

Example: useradd -m -d /home/xyz -c "xyz" xyz

The command useradd -D can be used to display this file.

Syntax: useradd -D

Userdel: To delete a user account userdel command is used.

Syntax: userdel -r <userName>

B) Device Management:

Device management is the process of managing the implementation, operation and


maintenance of a physical and/or virtual device. All Linux device files are located in the /dev
directory, which is an integral part of the root (/) filesystem because these device files must
be available to the operating system during the boot process.

Example: ls –l /dev

Above example gives the list of device file from kernel. Udev supplies a dynamic device
directory containing only the nodes for devices which are connected to the system. It
creates or removes the device node files in the /dev directory.
2. *Explain the use of following OS tools:

i) Device Manager ii) Task Scheduler iii) Performance monitor

Ans. i) Device Manager use:

1. Managing all the hardware or virtual devices of computer system.


2. Allow interaction with hardware devices through device driver.
3. Used to install device and component-level drivers as well as associated software.
4. Keeping track of all device’s data and location.

ii) Task scheduler use:

1. Used to automate the execution of programs, scripts, and various tasks at specific
intervals or specific events.
2. Used to select the next jobs to be admitted into the system and the next process to run.
3. Schedules tasks on CPU. Which task to run first, which has high priority, which has low
latency is decided by schedulers
4. Schedulers aim to provide fair access to system resources among competing
processes or users.

iii) Performance monitor

1. Monitor various activities on a computer such as CPU or memoryusage.


2. Used to examine how programs running on their computer affect computer’s
performance
3. It is used to identify performance problems or bottleneck that affect operating system
or installed applications.
4. Used to observe the effect of system configuration changes.

iv) Security Policy:

1. Installing and updating anti-virus software


2. Ensure the systems are patched or updated regularly
$ yum updates, $yum check-update
3. Installing a firewall and ensuring that it is properly set to monitor all incoming and
outgoing traffic.

v) User Management:

1. User management is used for creating a user, deleting a user

2. Assigning passwords to user using “passwd” command

3. Modifying attributes of a user


Extra

1. Explain memory management in detail

Ans. Main-Memory Management:

Primary-Memory or Main-Memory is a large array of words or bytes. Each word or byte has
its own address. Main-memory provides storage that can be access directly by the CPU.
That is to say for a program to be executed, it must in the main memory. The major activities
of an operating in regard to memory-management are:

• Keep track of which part of memory are currently being used and by whom.
• Decide which process are loaded into memory when memory space becomes available
• Allocate and De-allocate memory space as needed.

Secondary-Storage Management:

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:

• Managing the free space available on the secondary-storage device


• Allocation of storage space when new files have to be written.
• Scheduling the requests for memory access.
Describe with suitable diagram the concept of system call.

Ans. System Calls: System calls are programming interface to the services provided by the
operating system. A system call is a way for programs to interact with the operating system.
System calls provide an essential interface between a process and the operating system.

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. Just needs
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 is
managed by run-time support library.

You might also like