Chapter 2: Operating System Services (cont.)
Touch Screen Interface:
A touch screen interface is a type of computer display screen that allows the user to interact with the computer by touching the screen directly, instead of using a mouse or keyboard. This technology enables the user to perform actions such as tapping, swiping, and zooming by touching the screen with their fingers or a stylus.
Function Call vs Library Function Call vs System Call
Function Calls:
- A function call is an instruction in a program that invokes a specific function or subroutine to perform a certain task.
- A function call consists of the function name followed by a list of arguments in parentheses.
- The function executes the instructions within its body and returns control to the calling code once it is finished.
System Calls:
- System calls are a type of function call that provide an interface for a program to request services from the operating system.
- System calls allow the program to perform tasks such as accessing files, allocating memory, creating processes, and communicating with other programs.
Library Calls:
- Library calls are a type of function call that provide access to a library of pre-written functions.
- A library is a collection of functions and data that can be used by a program to perform various tasks.
- Library calls allow the programmer to make use of these pre-written functions without having to write the code themselves, making it easier to develop programs quickly and efficiently.
- Linking
- The linker is a software tool that combines object files and libraries generated by a compiler into a single executable program.
- It resolves symbolic references between functions and variables and adjusts memory addresses to create the final program
System Calls
- A request to the operating system to perform some activity
- These can be expensive
Steps in making a system call (See picture numbers and below)
-
1-3: PUSH parameter in stack
-
4-5: Library Call (puts syscall # in CPU register)
-
6: Switch to kernel mode (return address saved on stack)
-
7: Find system call handler
-
8: Run handler (index via table of pointers of syscall handles)
-
9: Return to user mode
-
10: Return to user program (via trap/interrupt)
-
11: Clean up
-
Address space
-
Parameter (in reverse order)
-
System call # in CPU register
-
Switch from user mode to kernel mode and back
-
Trap (a interrupt) interrupt ⇒ interrupt vector ⇒ interrupt handler (ISR)
-
Use of stack (during system call) and clean up (before completion of system call)


System call :
- OS is trusted, user is not
- OS has super privileges, user does not
- Must take measures to prevent abuse
Function Call:
- Same User
- Same ‘domain of trust’
<aside>
💡 Cache is transparent
</aside>

Five Categories of System calls
-
Process Management
-
File management:
-
Device Management:
- mkdir():
- rmdir():
- link()
- unlink()
- mount()
- unmount()
-
Information management
- stat()
- times(): Process running time
- getrusage(): Resource usage
- clock_gettime(): Get system time
-
Communication
- pipe()
- shmger(): share memory b/t processes
- mmap(): maps virtual memory
- socket(): network socket
- connect(): connect to a remote server
- accept(): accept remote connection
- send(): send network messages
System Call Parameter Passing: Memory, Address, stack
-
Monolithic Structure/Simple Structure:
-
Layered Structure:
- A hierarchical approach in which the operating system is divided into a number of layers, each layer building on the functionality of the lower layer.
- This allows for modular design and easier maintenance of the operating system.
- Break the OS into smaller layers