0% found this document useful (0 votes)
37 views13 pages

Operating System 2nd He

The document outlines the services and components of an operating system (OS), detailing various OS services such as user interface, program execution, I/O operations, file system manipulation, communication, and error detection. It explains the concept of system calls, their necessity, and how they function, along with categorizing them into process control, device management, file management, communication, and information maintenance. Additionally, it describes key OS components including process management, memory management, file management, I/O system management, and secondary storage management.

Uploaded by

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

Operating System 2nd He

The document outlines the services and components of an operating system (OS), detailing various OS services such as user interface, program execution, I/O operations, file system manipulation, communication, and error detection. It explains the concept of system calls, their necessity, and how they function, along with categorizing them into process control, device management, file management, communication, and information maintenance. Additionally, it describes key OS components including process management, memory management, file management, I/O system management, and secondary storage management.

Uploaded by

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

UNIT 2: SERVICES AND COMPONENTS OF OS

1. What are different OS services?

Fig : services provided by operating system.

Services provided by Operating System [UPIFCE]


1) User Interface

2) Program Execution

3) I/O Operation

4) File system Manipulation

5) Communication

6) Error Detection

1. User Interface :
i) All operating systems have a user interface that allows users to communicate with the system.
There are mainly 3 types of user interfaces are available: -
A) Command Line Interface(CLI) :
i) In command Line interface , user enters the text commands and methods for performing operation. ii) For
example, working on DOS prompt.
B) Batch Interface :
i) Batch interface uses files. A file contains the commands for various operations. When file executes,
command output is displayed on the screen.

C) Graphical user interface (GUI) :


i) This interface is a window system.
ii) For example, Windows system provides icons for selecting an application. Double clicking on that icon will
open that application.
2. Program Execution :
i) The operating system provides an environment where the user can conveniently run programs.
ii) Before executing the program, it is loaded into the memory by operating system. Once program loads into
memory, it starts execution.
iii) Program finished its execution with error or without error. It is up to the user for next operation.
3. Input/output operation :
i) When a program is running, it may require input/output resources such as a file or devices such as printer.
ii) OS provides the I/O devices to the program.
4. File system manipulation / file and directory operations :
i) Programs may need to read and write data from the files and directories.
ii) User wants to serch file or directory, rename file, modify file etc. User also create the file.
ii) All these operations is performed by user by using help of OS
5.Communication :
i) In the system, one process may need to exchange information with another process. Such communication may
occur between processes that are executing on same computer system or different computer systems.
ii) This Communication can be implemented via shared memory or through message passing which are methods
of communication in which packets of information are moved between processes by the operating system.
6. Error detection :
i) Error is related to the memory, CPU, I/O device and in the user program.
ii) Memory is full, stack overflow, file not found, directory not exits, printer is not ready are ex. Of error
detection.
iii) For each type of error, the operating system should take the appropriate action to ensure correct and
consistent computing.
2. What is system call? Explain its concept.

i) A system call is a way for a program(usually an application) to request a service from operating system .

ii) so we can say that, system calls provide the interface between a running program and operating system.

iii) system calls allowing the program to ask the OS to perform tasks that program doesn’t have direct
permission to do on its own

Why system calls are needed?

i) when you run a program on your computer, it often needs to perform actions like reading, writing files,
communicating with devices(like printer), or managing memory.

ii) However for security and stabality, programs aren’t allowed to directly access hardware or certain critical
system functions on their own.

iii) Instead, they need to ask the operating system to do these things on their behalf.

iv) This is why system calls are needed.

How system calls works ?

1. 1. Requesting a service :

i) When a program needs to perform action like reading, writing files it makes a system call.
Each system call associated with a particular number.
ii) This is like asking permission from the os to perform the action.
2. switching to Kernal Mode :
i) computers operate in different mode for safety. Programs usually runs in User Modes for safety, where they
have limited access to the system resources.
ii) The OS, however, runs in s Kernal Mode, where it has full access to the hardware.
iii) When a system call is made, the computer swiches from User Mode to Kernal Mode so OS can safely
perform the requested action.
3.Executing the system call :
i) The OS performs the requested service, wheater its opening the file, allocating memory or sending data.
Because it has direct access to hardware and system resoucses.
4.Returning to User Mode :
i) Once the OS has completed the requested task, it returns control back to the program and computer swithes to
the User Mode.
ii) The program can now continue its operation with the result of system call.
Why system calls are important ?
1. Security
2. Efficiency
3. Abstraction
Fig : working of system call

3. Enlist types of system calls.[PDFCI]

System calls can be categorized based on the services they provide

1. Process Control System Calls

2. Device Management System Calls

3. File Management System Calls

4. Communication System Calls

5. Information Maintenance System Calls


1. Process Control System Calls:

- Program in execution is a process.

- for execution of process it must be loaded in main memory.

-For managing the execution of programs, like a starting or stopping the program it may need following
system calls.

- fork() : to create a new process by duplicating existing one. The new process is called the child
process, and the old process called as parent process.

- exec() : to execute new program by replacing current process program .

- exit() : to terminate the current process and it returns its status to os and releases the
. used resorces ,

- Kill() : used to send signal to a process , either to terminate it or to controls its behavior based on
the specified signal type.

2. File Management System Calls:

- for reading, writing, opening, closing the files.

- Enable applications to access and manage data which store on a storage devices.

-open() : to open files for reading and writing the data . it returns file descriptor which is used to access
a file.

-read() : to read data from file descriptor and the data get store into the buffer.

- write() : to write data from buffer to file .

- close() : to close an open file and free up resources associated with it.

3. Device Management System Calls:

- Device management system calls allow the operating system to interact with hardware devices like
printers, keyboards or disks. And it allow to manage them efficiently.

- These calls are used to request, release, and control devices during program execution.
- Examples :
1. read() : To read data from a device into a buffer.

2. write() : To write/send data from a buffer to a device.

3. open() : to open a divice or files for reading and writing the data . it returns file descriptor
which is used to access a file
4. ioctl() (Input/Output Control) : Used to control a device or perform device-specific operations that
cannot be done through standard calls like read() and write().

4. Information Maintenance System Calls:

- These system calls are used to manage and retrieve information about processes, files, and system
configurations.
1. getpid():

• Retrieves the process ID of the current process.

2. getppid():

• Retrieves the process ID of the parent process.

3. stat():

• Retrieves detailed information about a file, such as its size, permissions, and timestamps.

4. time():

• Returns the current system time.

5. uname():

• Retrieves information about the operating system, like its name, version, and release.

5. Communication System Calls:

Communication System Calls


• These system calls enable processes to communicate with each other, either on the same machine or
across a network.

1. pipe():

o Creates a unidirectional communication channel between processes, allowing data


transfer from one process to another.

2. shmget():

o Allocates shared memory for communication between processes.

3. mmap():

o Maps a file or memory object into the process's address space for communication or
data sharing.

4. socket():

o Creates a communication endpoint for data transfer over a network.

5. send() and recv():

o Used for sending and receiving messages over a socket in a network communication.

6. msgsnd() and msgrcv():

o Used for sending and receiving messages via message queues.

4. What are operating system components?

1.Process management

2.Main memory management

3. File management

4. I/O system management

5. Secondary storage management


1.Process management (first two points only then explain functions and activities)

Process Creation and Termination : When a process is created, the OS allocates necessary resources and
assigns a unique identifier (PID). When it completes its execution it releases the used resources

Process Scheduling : The OS uses scheduling algorithms, such as First-Come, First Serve (FCFS), Shortest Job
Next (SJN), Round Robin (RR), and Priority Scheduling, to manage process execution.

Controlling the progress of a process

Inter-Process Communication (IPC)The OS provides mechanisms that allow processes to communicate with
each other.two ways are shared memory and message passing.

2.Main memory management

- Memory management is a fundamental component of an operating system.


- It is responsible for handling and optimizing the computer’s primary memory(RAM).
- It makes sure that every running program gets enough memory to execute their tasks.
- The overall performance of the computer system is affected by performance of memory
management
- Basic memory management tasks/functions/activities include :
1. Memory allocation and deallocation:
- The operating system allocates memory to processes as needed and it deallocates memory when
process finish their tasks , means memory get free after deallocation of process .
2. Tracking memory usage :
The system keeps track of each memory block to know which areas are free and which are allocated.
3. Swapping and Virtual Memory Management
- The OS may use virtual memory to extend physical memory by swapping inactive parts of processes to
disk (swap space), freeing up RAM for active processes.
4. Fragmentation Management:
- As programs are loaded and unloaded from memory, small gaps (fragmentation) can occur.
- Memory management techniques like compaction or paging are used to handle fragmentation,
ensuring memory is used efficiently.

3. File management :
- In an operating system, a "file" is a fundamental unit of data storage that contains information, data, or
instructions.
- Files are organized into the directory and folders which help in organizing, accessing, and managing
data effectively.
- It also allows all files to be easily changed and modified thorugh the use of text editor.
- File management tasks/functions/activities include :

1. The creation and deletion of files.


- The OS allows users to create new files and delete existing ones. This involves allocating or
deallocating space on storage devices.
2. The creation and deletion of directories.
- The OS allows users to create new directories and delete existing ones. This involves allocating or
deallocating space on storage devices.

3. Transmission of file elements between main and secondary storage.


- According to needs , The OS manages the movement of file data between primary memory (RAM) and
secondary storage (like HDD or SSD)
4. The mapping of files onto secondary storage.
5. The backup of files on stable storage media.

4. I/O system management :

i) Input / Output device management provides an environment for the better interaction between system and
the I/O devices (such as printers, scanners, tape drives etc.).
ii) To interact with I/O devices in an effective manner, the operating system uses some special programs

known as device driver.


iii) The device drivers take the data that operating system has defined as a file and then translate them into
streams of bits.
iv) Only the device driver knows the peculiarities[अलग विशेषताएँ या अनोखे गुण] of the specific device to
which it is assigned .
1 The input output subsystem consists of several components :
- A memory management component that includes buffering caching, spooling.
- A general device driver interface.
- Driver for specific h/w devices.
5. Seconday storage management :
- The computer system provides secondary storage to back up main memory.
- Secondary storage is required because main memory is too small to accommodate all data and
programs, and the data that it holds is lost when power is lost.
- Most of the programs including compilers, assemblers, word processors, editors, and formatters are
stored on a disk until loaded into memory.
- Secondary storage consists of tapes drives, disk drives, and other media.
- The operating system is responsible for the following activities in connection with disk management:
• Free space management • Storage allocation • Disk scheduling

Operating system tools :[udpst]

2.4 Use of operating system tools :

1. user management

2. Device management**

3. Performance monitor**

4. Task scheduler **

5. Security policy
1. User management

Here are two uses of the User Management tool in an operating system:

1. Managing User Access and Permissions:


- The user management tool allows system administrators to create, modify, and delete user accounts.
- It also enables them to assign permissions and roles, ensuring that each user has access only to the
files and resources they need. This help to maintain security by limiting access to sensitive information.

2. Monitoring and analysis User Activity: [Har user ki activities ko logs me record karna, jisse baad me check kiya ja sake ki kisne kya kiya]
- User management tools often include logging and tracking features, which allow administrators to
monitor user activities on the system.
- This can be helpful for analysis purposes, and it can be helpful for identifying any unauthorized access
attempts.

2. Device management

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

2. Allow interaction with hardware devices through device driver.

4. Allocate devices to the process as per process requirement and priority.

5. Keeping track of all device’s data and location.

6. Monitoring device status like printers, storage drivers and other devices.

3. Performance monitor[monitor,examine,identify,observe]

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

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.


4. Task schedular[assign,predefined,schedule]

1 . Assign processor to task , when it is ready for execution .

2. Executing predefined actions automatically whenever a certain set of condition is met.

3. Used to determine which process has access to the cpu and for how long.

4. It is used to schedule the tasks of the CPU which process to run first ,which has high priority ,which has
low priority is decided by the scheduler.

5. Task schedulers used to maximize the overall throughput of the system by executing tasks in a manner
that minimizes idle time of CPU. This can be done using various algo like example .

5. Security policy

. Install and regularly update anti-virus software to protect against malware.

. Ensure systems are patched or updated regularly using commands like $yum update and $yum check-update
to fix vulnerabilities.

. Implement user management policies to safeguard accounts and limit unnecessary privileges.

. Install a firewall and configure it to monitor and control all incoming and outgoing network traffic effectively.

You might also like