0% found this document useful (0 votes)
23 views9 pages

Components of OS System Calls Kernels (CO1)

The document explains system calls in operating systems, detailing how user programs interact with the OS through predefined functions for various services like file management, process control, and device management. It also contrasts microkernel and monolithic kernel architectures, highlighting their advantages and disadvantages, and outlines the key components of an operating system, including process, memory, and network management. Additionally, it provides examples of system calls in Unix and describes the functions of various OS components.

Uploaded by

shagun
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)
23 views9 pages

Components of OS System Calls Kernels (CO1)

The document explains system calls in operating systems, detailing how user programs interact with the OS through predefined functions for various services like file management, process control, and device management. It also contrasts microkernel and monolithic kernel architectures, highlighting their advantages and disadvantages, and outlines the key components of an operating system, including process, memory, and network management. Additionally, it provides examples of system calls in Unix and describes the functions of various OS components.

Uploaded by

shagun
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/ 9

System Calls in Operating System (OS)

A system call is a way for a user program to interface with the operating system. The program requests
several services, and the OS responds by invoking a series of system calls to satisfy the request. A system
call can be written in assembly language or a high-level language like C or Pascal. They are predefined
functions that the operating system may directly invoke if a high-level language is used.

How are system calls made?

When a computer software needs to access the operating system's kernel, it makes a system call. The
system call uses an API to expose the operating system's services to user programs. It is the only method
to access the kernel system. All programs or processes that require resources for execution must use
system calls, as they serve as an interface between the operating system and user programs.

Why do you need system calls in Operating System?

There are various situations where you must require system calls in the operating system.

1. It is required when a file system wants to create or delete a file.


2. Network connections require the system calls for sending and receiving data packets.
3. If you want to read or write a file, you need to system calls.
4. If you want to access hardware devices, including a printer, scanner, you need a system call.
5. System calls are used to create and manage new processes.

How System Calls Work?

The applications run in an area of memory known as user space. A system call connects to the operating
system's kernel, which executes in kernel space. When an application creates a system call, it must first
obtain permission from the kernel. It achieves this using an interrupt request, which pauses the current
process and transfers control to the kernel.

If the request is permitted, the kernel performs the requested action, like creating or deleting a file. As
input, the application receives the kernel's output. The application resumes the procedure after the input is
received. When the operation is finished, the kernel returns the results to the application and then moves
data from kernel space to user space in memory.

Types of System Calls

There are commonly five types of system calls. These are as follows:

1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication

Process Control

Process control is the system call that is used to direct the processes. Some process control examples
include creating, load, abort, end, execute, process, terminate the process, etc.

File Management

File management is a system call that is used to handle the files. Some file management examples include
creating files, delete files, open, close, read, write, etc.

Device Management

Device management is a system call that is used to deal with devices. Some examples of device
management include read, device, write, get device attributes, release device, etc.

Information Maintenance

Information maintenance is a system call that is used to maintain information. There are some examples
of information maintenance, including getting system data, set time or date, get time or date, set system
data, etc.

Communication

Communication is a system call that is used for communication. There are some examples of
communication, including create, delete communication connections, send, receive messages, etc.

Examples of Unix system calls

Process Unix

Process Control Fork()


Exit()
Wait()

File Manipulation Open()


Read()
Write()
Close()

Device Management Ioctl()


Read()
Write()

Information Maintenance Getpid()


Alarm()
Sleep()
Communication Pipe()
Shmget()
Mmap()

Protection Chmod()
Umask()
Chown()

Here, you will learn about some methods briefly:

open()

The open() system call allows you to access a file on a file system.

read()

It is used to obtain data from a file on the file system.

wait()

In some systems, a process may have to wait for another process to complete its execution before
proceeding. When a parent process makes a child process, the parent process execution is suspended until
the child process is finished. The wait() system call is used to suspend the parent process. Once the child
process has completed its execution, control is returned to the parent process.

write()

It is used to write data from a user buffer to a device like a file.

fork()

Processes generate clones of themselves using the fork() system call. It is one of the most common ways
to create processes in operating systems. When a parent process spawns a child process, execution of the
parent process is interrupted until the child process completes. Once the child process has completed its
execution, control is returned to the parent process.

close()

It is used to end file system access. When this system call is invoked, it signifies that the program no
longer requires the file, and the buffers are flushed, the file information is altered, and the file resources
are de-allocated as a result.

exit()

The exit() is a system call that is used to end program execution. This call indicates that the thread
execution is complete, which is especially useful in multi-threaded environments. The operating system
reclaims resources spent by the process following the use of the exit() system function.
Microkernel
Microkernel is a type of kernel that allows customization of the operating system. It runs on privileged
mode and provides low-level address space management and Inter Process Communication (IPC).
Moreover, OS services such as file system, virtual memory manager, and CPU scheduler are on top of the
microkernel. Each service has its own address space to make them secure. Besides, the applications also
have their own address spaces. Therefore, there is protection among applications, OS Services and kernel.

When the application requests the OS services for a service, the OS services communicate with each other
to provide the required service to the application. Here, the Inter Process Communication (IPC) helps to
establish this communication.
Examples of microkernel include: QNX, Symbian, L4Linux, HURD, Minix, Mac OS X, and Coyotos.

Advantages of Microkernel

 Microkernel architecture is small and isolated therefore it can function better.


 Microkernels are secure because only those components are included that disrupt the functionality
of the system otherwise.
 The expansion of the system is more accessible, so it can be added to the system application
without disturbing the Kernel.
 Microkernels are modular, and the different modules can be replaced, reloaded, modified without
even touching the Kernel.
 Fewer system crashes when compared with monolithic systems.
 Without recompiling, add new features
 Server malfunction is also isolated as any other user program’s malfunction.
Disadvantage of Microkernel

 Providing services in a microkernel system are expensive compared to the normal monolithic
system.
 Context switch or a function call needed when the drivers are implemented as procedures or
processes, respectively.
 The performance of a microkernel system can be indifferent and may lead to some problems.
Monolithic Kernel
In monolithic kernel-based systems, each application has its own address space. Therefore, each
application is secure. Also, the kernel contains all the OS services. Therefore, the applications can request
services from the kernel. Some OS services are file system, CPU Scheduler, network access, memory
manager etc. However, the OS is in a separate address space. Therefore, it is secure from the normal
applications and malfunctioned applications.

Examples of monolithic kernel include: Linux, BSDs (FreeBSD, OpenBSD, NetBSD), OS-9, AIX, HP-
UX, DOS, OpenVMS, XTS-400, Microsoft Windows (95,98,Me), and Solaris.

Microkernel and Monolithic Kernel Systems


The main difference between microkernel and monolithic kernel is that the microkernel-based systems
have OS services and kernel in separate address spaces while the monolithic kernel-based systems have
OS services and kernel in the same address space.
Components of Operating System
An operating system is a large and complex system that can only be created by partitioning into small
parts. These pieces should be a well-defined part of the system, carefully defining inputs, outputs, and
functions.
Although Windows, Mac, UNIX, Linux, and other OS do not have the same structure, most operating
systems share similar OS system components, such as file, memory, process, I/O device management.
The components of an operating system play a key role to make a variety of computer system parts work
together. There are the following components of an operating system, such as:
1. Process Management
2. File Management
3. Network Management
4. Main Memory Management
5. Secondary Storage Management
6. I/O Device Management
7. Security Management
8. Command Interpreter System
Operating system components help you get the correct computing by detecting CPU and memory
hardware errors.
1. Process Management
The process management component is a procedure for managing many processes running simultaneously
on the operating system. Every running software application program has one or more processes
associated with them.For example, when you use a search engine like Chrome, there is a process running
for that browser program.Process management keeps processes running efficiently. It also uses memory
allocated to them and shutting them down when needed.The execution of a process must be sequential so,
at least one instruction should be executed on behalf of the process.

Functions of process management


Here are the following functions of process management in the operating system, such as:
o Process creation and deletion.
o Suspension and resumption.
o Synchronization process
o Communication process
2. File Management
A file is a set of related information defined by its creator. It commonly represents programs (both source
and object forms) and data. Data files can be alphabetic, numeric, or alphanumeric.

Function of file management


The operating system has the following important activities in connection with file management:
o File and directory creation and deletion.
o For manipulating files and directories.
o Mapping files onto secondary storage.
o Backup files on stable storage media.

3. Network Management
Network management is the process of administering and managing computer networks. It includes
performance management, provisioning of networks, fault analysis, and maintaining the quality of
service.
The computers in the network are connected through a communication network, which can configure in
many different ways. The network can fully or partially connect in network management, which helps
users design routing and connection strategies that overcome connection and security issues.
Functions of Network management
Network management provides the following functions, such as:
o Distributed systems help you to various computing resources in size and function. They may
involve minicomputers, microprocessors, and many general-purpose computer systems.
o A distributed system also offers the user access to the various resources the network shares.
o It helps to access shared resources that help computation to speed up or offers data availability
and reliability.

4. Memory Management
The functionality of an OS is nothing but memory management which manages main memory & moves
processes backward and forward between disk & main memory during implementation. This tracks each
& every memory position; until it is assigned to some process otherwise it is open. It verifies how much
memory can be allocated to processes and also makes a decision to know which process will obtain
memory at what time. Whenever memory is unallocated, then it tracks correspondingly to update the
status. Memory management work can be divided into three important groups like memory management
of hardware, OS and application memory management.
Functions of Memory management in OS
An Operating System performs the following functions for Memory Management:
 It helps you to keep track of primary memory.
 Determine what part of it are in use by whom, what part is not in use.
 In a multiprogramming system, the OS takes a decision about which process will get Memory and
how much.
 Allocates the memory when a process requests
 It also de-allocates the Memory when a process no longer requires or has been terminated.

5. Secondary-Storage Management
The most important task of a computer system is to execute programs. These programs, along with the
data, helps you to access, which is in the main memory during execution.
This Memory of the computer is very small to store all data and programs permanently. The computer
system offers secondary storage to back up the main Memory. Today modern computers use hard
drives/SSD as the primary storage of both programs and data. However, the secondary storage
management also works with storage devices, like a USB flash drive, and CD/DVD drives.
Functions of Secondary storage management in OS:
Here, are major functions of secondary storage management in OS:
 Storage allocation
 Free space management
 Disk scheduling

6. I/O Device Management


The I/O device management component is an I/O manager that hides the details of hardware devices and
manages the main memory for devices using cache and spooling. This component provides a buffer cache
and general device driver code that allows the system to manage the main memory and the hardware
devices connected to it. An I/O device management component allows highly efficient resource utilization
while minimizing errors and making programming easy on the entire range of devices available in their
systems.

7. Security Management
The security mechanisms in an operating system ensure that authorized programs have access to
resources, and unauthorized programs have no access to restricted resources. Security management refers
to the various processes where the user changes the file, memory, CPU, and other hardware resources that
should have authorization from the operating system.
8. Command Interpreter
There are several ways for users to interface with the operating system. One of the approaches to user
interaction with the operating system is through commands. Command interpreter provides a command-
line interface. It allows the user to enter a command on the command line prompt (cmd). The command
interpreter accepts and executes the commands entered by a user. For example, a shell is a command
interpreter under UNIX. The commands to be executed are implemented in two ways:
 The command interpreter itself contains code to be executed.
 The command is implemented through a system file. The necessary system file is loaded into
memory and executed.

You might also like