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

140 OS

The document discusses the distinction between kernel mode and user mode in operating systems, highlighting how this separation functions as a security measure by limiting access to system resources. It explains that user mode restricts applications from directly interacting with hardware, while kernel mode allows the operating system full access to manage resources. Additionally, it describes the role of system calls as a bridge between user applications and the operating system, providing essential services like reading and writing data through controlled interactions with hardware.
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)
5 views

140 OS

The document discusses the distinction between kernel mode and user mode in operating systems, highlighting how this separation functions as a security measure by limiting access to system resources. It explains that user mode restricts applications from directly interacting with hardware, while kernel mode allows the operating system full access to manage resources. Additionally, it describes the role of system calls as a bridge between user applications and the operating system, providing essential services like reading and writing data through controlled interactions with hardware.
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/ 5

C0MSATS UNIVERSITY

ISLAMABAD, SAHIWAL
CAMPUS
ASSIGNMENT NO.01

SUBMITTED BY Ali Hasnain

SUBJECT: Operating System

REGISTRATION NO: FA23-BSE-140


SUBMITTED TO: Ms. Shaheen Kousar

DEPARTMENT OF COMPUTER
SCIENCE
Question 1

How does the distinction between kernel mode and user mode function as a
rudimentary form of protection (security)?

User Mode:
A restricted mode where applications run with limited access to system resources.
Programs in user mode cannot directly interact with hardware or critical system
functions to prevent system crashes or security breaches

Characteristics:

 Privilege Level: User mode has Low access.


 Purpose: User mode is where most user applications like web browsers, word
processors, or games run.
 Access Restrictions: In user mode, programs cannot directly access hardware or
interact with critical parts of the system, like memory
 Protection: By limiting access to the system, user mode prevents programs from
causing damage or crashing the entire system

Example: Suppose you are running a word processor on your computer. This
application operates in user mode.

Kernal Mode:

A privileged mode where the operating system operates with full access to all hardware
and system resources. The kernel has complete control over the system and handles tasks
like memory management, device drivers, and hardware communication.
Characteristics:

 Privilege Level: Kernal Mode has high Access.


 Purpose: Kernel mode is where the OS itself operates, along with certain trusted
parts like device drivers.
 Access: In kernel mode, the OS has unrestricted access to all system resources,
including memory and hardware.
 Risk: kernel-mode code can cause the entire system to crash or become unstable.
 Example: When your operating system manages memory or handles input
from your keyboard, it's working in kernel mode.

User Mode and Kernal Mode in terms of Protection:

The difference between kernel mode and user mode helps ensure basic security by
controlling access to important system functions. In kernel mode, the operating
system can freely access hardware and perform sensitive tasks, while in user mode,
regular programs are restricted from directly accessing these resources. This
separation prevents user programs from doing anything harmful, as they need to ask
permission through system calls for any privileged actions. By managing access this
way, the system stays protected from unauthorized or accidental damage, keeping
both the operating system and other programs safe.
References:

 Silberschatz, A., Galvin, P. B., & Gagne, G. (2020). Operating System Concepts (8th
ed.). Wiley.

Question No 2

Explain the role of system calls in an operating system. Choose a few specific
system calls and describe how they interact with hardware to provide
essential services to application

The Role of System Calls in an Operating System

System calls act as a bridge between user applications and the operating system, allowing
programs to request services that they don't have direct access to, such as interacting with
hardware. Since user applications run in a restricted user mode for security reasons, they rely on
system calls to access critical resources managed by the operating system in kernel mode.

Examples of System Calls and Their Functionality:

For example: We have Some System calls and its work is given below:

read():

When an application wants to read data from a file, it uses the read() system call. This is like
asking the operating system to get the data from storage, such as a hard drive. The operating
system, using the kernel, communicates with the hardware to retrieve the data safely. This prevents
the application from directly handling the hardware, which could lead to mistakes or security
problems.

fork():

Another system call is fork(), which is used to create new processes. When an application calls
fork(), the operating system makes a copy of the current process, giving it the necessary memory
and resources to run. The kernel ensures everything is set up properly for the new process while
keeping control over how resources are shared between processes.

write():

The write() system call is used when an application needs to send data to a device (like a printer)
or save data to a file. The operating system takes the request and interacts with the hardware (like
the file system or printer) to ensure the data is written correctly

You might also like