0% found this document useful (0 votes)
13 views

System Call

System calls are essential for interaction between user programs and the operating system, allowing processes to access resources and perform tasks through an API. They can be categorized into types such as process control, file management, device management, information maintenance, communication, and protection, each serving specific functions. Operating systems can have various structures, including simple, monolithic, layered, microkernel, and modular designs, each with its own advantages and disadvantages regarding performance, security, and maintainability.

Uploaded by

bhavanim9901
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)
13 views

System Call

System calls are essential for interaction between user programs and the operating system, allowing processes to access resources and perform tasks through an API. They can be categorized into types such as process control, file management, device management, information maintenance, communication, and protection, each serving specific functions. Operating systems can have various structures, including simple, monolithic, layered, microkernel, and modular designs, each with its own advantages and disadvantages regarding performance, security, and maintainability.

Uploaded by

bhavanim9901
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/ 8

System Call

System Calls method of interacting with the OS via


programs

System calls provide an interface between a


process and an operating system. In general,
system calls are available as assembly language
instructions. System calls are usually made when
a process in user mode requires access to a
resource. Typically written in a high-level
language (C or C++).
System calls provide the means for a user
program to ask the operating system to perform the tasks provided by the
operating system on the user program’s behalf. These services offered with the
help of API (Application Programming Interface)
Need of system calls
 To read and write from files
 To create or del files
 To create & manage new processes
 To send and receive packets thru NT connections
 To access hardware devices
User mode: execution is done on behalf of the user
Kernel mode: execution is done on behalf of OS
How System calls work?

1. The first input the program needs is the name of the two files: the input file
and the output file. The inputting file name requires many I/O system calls.
2. Then, the program must open the input file and create the output file. When it
tries to open the input file, it may find that there is no file of that name or that
the file is protected against access. In such cases, the program must print an
error message on the console(another sequence of system calls).
3. When there is already an output file with the same name, the program may
abort(a system call), or delete the existing file(another system call) and
create a new one(create system call).
4. Then the program enters into a loop that reads the input file(a system call)
and writes to the output file(another system call).
5. After the entire file is copied, the program may close both the file(another system
call).

 Types of System Calls


 Process control
 File management
 Device management
 Information maintenance
 Communications
 Protection

 Process Control : Process control system calls are used to manage processes,
such as creating, terminating, and executing them. They are used in operating
systems to allow applications to run smoothly without interfering with each other.
Functions of process control :
i) End and Abort
ii) Loading and execution of process
iii) Creation and termination of a process
iv) Wait and signal event
v) Allocation of free memory
 File Management: used to handle the files
Functions of file management:
i) Creation of files
ii)Deletion of files
iii)Opening & closing of a file
iv)Reading, writing, and reposition
v) Getting and setting file attributes.

 Device Management  system call deals with devices (reading from device
buffer or writing into device buffers : A process may need several resources to
execute—main memory, disk drives, access to files, and so on. If the resources are
available, they can be granted, and control can be returned to the user process.
Otherwise, the process will have to wait until sufficient resources are available.
Some of these devices are physical devices (for example, tapes), while others can
be thought of as abstract or virtual devices (for example, files)
Functions of device management
i) Requesting & releasing devices
ii) Attaching & detaching devices logically
iii) Getting & setting device attributes

 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. Other system calls may return information about the system, such as the
number of current users, the version number of the operating system, the amount
of free memory or disk space, and so on.

 In addition, the operating system keeps information about all its processes, and
system
calls are used to access this information.
Generally, calls are also used to reset the process information (get process
attributes and set process attributes) .
 Communication: used for inter process communication
Function of IPC
 Creation & deletion of communication connections
 Sending & receiving messages
 Helping OS transfer status information
 Attaching or detaching remote devices

Protection:
Provides a mechanism for controlling access to the resources provided by a
computer system.
Function of Protection:
i. Protection including the permission & getting the permission.
ii. Manipulating the permission settings of resources such as files and disks
iii. Whether particular users can or cannot be allowed access to certain
resources

Important system calls used in OS


 fork(): Creates a copy(clone) of a process, which allows for concurrent execution of
tasks(parent & child process)
 exec(): Runs an executable file in the context of an existing process, new process
replaces old process
 exit(): Terminates a program's execution, and the OS reclaims the process's
resources(thread execution is complete used in multithread environment)
 open(): Opens a file, allows to access a file on a file system.
 read(): Reads data from a file, accepts 3 arguments:file descriptor, buffer to store read
data, number of bytes to read from the file
 write(): Writes data to a file, accepts 3 arguments: file descriptor, ptr to the buffer in
which data is saved, number of bytes to be written from the buffer
 wait(): when parent & child process is executing.
 close(): to end file system. deallocates.

Operating system structure:


 OS has complex structure
 As we break big problem into smaller, easier to solve likewise OS split into simpler
approach.
 Interconnecting and integrating multiple OS components into the kernel can be
descried as an OS structure.

Simple Structure

A Simple Structure OS has a minimal organization, often lacking clear modularization. The
entire system is loosely divided into layers, but the separation is not strict.

Example OS:

 MS-DOS

 Early UNIX

Advantages:

✅ Easy to design and implement – Due to its straightforward structure, development is


relatively simple.
✅ Fast execution – Since there is minimal separation between components, communication
overhead is low.
✅ Efficient resource usage – Less abstraction means better direct hardware interaction.

Disadvantages:

❌ Lack of proper modularity – Difficult to maintain, update, or expand.


❌ Poor security – Since different parts of the system interact freely, security vulnerabilities
are harder to isolate.
❌ Harder debugging and error handling – A failure in one part can crash the entire system.

2. Monolithic Structure

A Monolithic Structure OS has all its components (e.g., file system, memory management,
I/O, etc.) compiled into a single large kernel, running in kernel mode.

Example OS:

 Linux

 Windows (earlier versions)

 UNIX
Advantages:

✅ Fast execution – System calls and kernel operations are handled efficiently within the
same memory space.
✅ Direct hardware access – Leads to better performance.
✅ Simpler design compared to microkernels – Since everything is in one kernel,
interactions between OS components are fast and direct.

Disadvantages:

❌ Large and complex codebase – Hard to manage, update, and debug.


❌ Lack of flexibility – Modifying or adding features often requires recompiling the entire
kernel.
❌ Higher risk of system crashes – Since all components run in kernel mode, a failure in one
part can bring down the entire system.

Layered Approach Structure

In a layered OS, the system is divided into multiple layers, each performing specific
functions. The lower layers interact directly with hardware, while higher layers provide user-
level services.

Example OS:

 THE OS (First layered OS)

 UNIX (partially layered)

 Windows NT (partially layered)

Advantages:

✅ Modularity – Easier to debug and maintain since each layer is


independent.
✅ Security – Higher layers are protected from direct access to hardware.
✅ Simplicity – The system is easier to design and understand.

Disadvantages:

❌ Performance Overhead – Calls between layers may introduce delays.


❌ Strict Hierarchy – Communication between non-adjacent layers can be complex.
❌ Difficult Design – Deciding the number and function of layers requires careful planning.

2. Microkernel Structure
A microkernel OS keeps only the essential core functions (like memory management,
process scheduling, and IPC) in the kernel. Other services (such as device drivers and file
systems) run in user space.

Example OS:

 MINIX

 QNX

 macOS (partially microkernel-based)

Advantages:

✅ Better security & reliability – Less code running in kernel mode


reduces crashes and vulnerabilities.
✅ Easier to extend – New services can be added without modifying the kernel.
✅ Better fault isolation – A failed service does not crash the entire OS.

Disadvantages:

❌ Performance Overhead – More context switches and IPC (inter-process communication)


cause latency.
❌ Complex communication – User-space services must frequently communicate with the
microkernel, increasing complexity.
❌ Slower than monolithic kernels – Due to frequent system calls and message passing.

3. Modular Structure

A modular OS is designed like a monolithic OS but with the ability to load and unload
kernel modules dynamically.

Example OS:

 Linux (supports loadable kernel modules - LKM)

 Windows (modern versions use a modular kernel)

Advantages:

✅ Flexibility – Modules can be added or removed without rebooting.


✅ Better maintainability – Easy to update or replace individual components.
✅ Balanced performance – Avoids the performance issues of microkernels while
maintaining some flexibility.

Disadvantages:
❌ Complex implementation – Managing dynamic module loading requires careful design.
❌ Security risks – Vulnerabilities can be introduced if modules are not properly verified.
❌ Potential instability – If a module crashes, it can affect the entire system.

Modular Structure in Operating Systems


A Modular Structure in an operating system is a
hybrid approach that combines the benefits of
monolithic and microkernel designs. Instead of
compiling the entire OS as a single entity, the OS
is divided into independent modules that can be
loaded or unloaded as needed.
Examples of Modular OS
 Linux (Supports Loadable Kernel
Modules - LKM)
 Windows (NT-based) (Uses modular
components for drivers and services)
 Solaris (Supports dynamically loadable kernel modules)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy