Operating System 2nd He
Operating System 2nd He
2) Program Execution
3) I/O Operation
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.
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
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.
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
-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.
- 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.
- 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.
- close() : to close an open file and free up resources associated with it.
- 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.
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().
- These system calls are used to manage and retrieve information about processes, files, and system
configurations.
1. getpid():
2. getppid():
3. stat():
• Retrieves detailed information about a file, such as its size, permissions, and timestamps.
4. time():
5. uname():
• Retrieves information about the operating system, like its name, version, and release.
1. pipe():
2. shmget():
3. mmap():
o Maps a file or memory object into the process's address space for communication or
data sharing.
4. socket():
o Used for sending and receiving messages over a socket in a network communication.
1.Process management
3. File management
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.
Inter-Process Communication (IPC)The OS provides mechanisms that allow processes to communicate with
each other.two ways are shared memory and message passing.
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 :
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
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:
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
6. Monitoring device status like printers, storage drivers and other devices.
3. Performance monitor[monitor,examine,identify,observe]
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.
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
. 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.