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

Operating System Notes

OS CONTENT

Uploaded by

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

Operating System Notes

OS CONTENT

Uploaded by

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

SYSTEM CALLS

System Calls

• To understand system calls, first one needs to


understand the difference between kernel
mode and user mode of a CPU. Every modern
operating system supports these two modes.
• „ The services provided by the kernel to application
programs. „ This interface is needed because there
are things (eg: I/O instructions) that only the kernel is
allowed to perform.
MODES SUPPORTED BY OS
Kernel Mode

• When CPU is in kernel mode, the code being


executed can access any memory address and
any hardware resource.
• Hence kernel mode is a very privileged and
powerful mode.
• If a program crashes in kernel mode, the
entire system will be halted.
User Mode,
• When CPU is in  user mode, the programs don't
have direct access to memory and hardware
resources.
• In user mode, if any program crashes, only that
particular program is halted.
• That means the system will be in a safe state
even if a program in user mode crashes.
• Hence, most programs in an OS run in user
mode.
System Call

• When a program in user mode requires access


to RAM or a hardware resource, it must ask
the kernel to provide access to that resource.
This is done via something called a system
call.
• When a program makes a system call, the mode is switched from
user mode to kernel mode. This is called a context switch.
• Then the kernel provides the resource which the program
requested. After that, another context switch happens which
results in change of mode from kernel mode back to user mode.
• Generally, system calls are made by the user level programs in the
following situations:
• Creating, opening, closing and deleting files in the file system.
• Creating and managing new processes.
• Creating a connection in the network, sending and receiving
packets.
• Requesting access to a hardware device, like a mouse or a printer
Types of System Calls
• PROCESS CONTROL
• end, abort
• load, execute
• Create process, terminate process
• Get process attributes, set process attributes
• wait for time
• wait event, signal event
• allocate and free memory
File management

• create file, delete file


• open, close file
• read, write, reposition
• get and set file attributes
Device management

•  request device, release device


• read, write, reposition
• get device attributes, set device attributes
• logically attach or detach devices
Information maintenance

• get time or date, set time or date


• get system data, set system data
• get and set process, file, or device attributes
Communications

• create, delete communication connection


• send, receive messages
• transfer status information
• attach and detach remote devices
Examples of Windows and Unix System Calls

You might also like