Operating System 4
Operating System 4
Assumptions
• User code can be arbitrary
• User code cannot modify kernel Memory
Design Issues
• User makes a system call with parameters
• The call mechanism switches code to kernel mode
• Execute system call
• Return with results
1
18-01-2025
2
18-01-2025
Function Call
Process
fnCall()
Process Process
fnCall() sysCall()
OS
3
18-01-2025
System Calls
System Calls
A request to the operating system to perform some activity
4
18-01-2025
After the switch to kernel mode, the processor must save all of its registers and
dispatch execution to the proper kernel function, after checking whether EAX is out of
range. The system call we are looking at is implemented in the sys_read function. The
read finally performs the data transfer and all the previous steps are unwound up to
the calling user function.
10
5
18-01-2025
11
Differences?
Is printf() a system call?
Is rand() a system call?
12
6
18-01-2025
2: System Call
3: Library Call
13
14
7
18-01-2025
• Process control
• create process, terminate process
• end, abort
• load, execute
• get process attributes, set process attributes
• wait for time
• wait event, signal event
• allocate and free memory
• Dump memory if error
• Debugger for determining bugs, single step execution
• Locks for managing access to shared data between processes
15
• 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
16
8
18-01-2025
• 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 if message passing model to host name or process name
• From client to server
• Shared-memory model create and gain access to memory regions
• transfer status information
• attach and detach remote devices
17
• Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
18
9
18-01-2025
19
20
10