Lesson 2: Syscalls and interrupts Flashcards
Privileged instructions
The way the OS talks with the hardware and storage. Only the OS can give these instructions and not a user.
Interrupts
The wat the hardware speaks to the OS
User mode
When the CPU is running the user’s code
Kernel mode
When the CPU is running the OS’s code
System calls
Moves from user mode to kernel mode
Privileged mode
= Kernel mode
How can user programs access or alter internal OS data structures or hardware?
Through system calls only (protection)
Difference between system calls and other internal OS functions
System calls check the validity of the parameters, whereas other internal OS functions don’t.
What’s the name of the process moving from the user to the kernel mode?
Trap
Trap
The process of switching between user and kernel mode
Mode bit
Provides ability to distinguish when system is running user code or kernel code. This way some instructions that are privileged can only be executed in the kernel mode.
What causes the mode to change from user to kernel?
System call
What causes the mode to change from kernel to user?
The return from the system call
What can cause a transition from user to kernel mode?
- A system call
2. An exception (e.g., divide by 0) - handled as part of the CPU architecture.
Is “echo”, “grep” and other functions in the shell part of the OS?
No. They are applications that run above the OS but can be considered as OS services.
What are the 6 layers of the computer system?
- Apps
- User interface - shell or windows
- Libraries - the interface the OS gives us so we can use it with other applications
- OS abstractions - file systems, jobs/processes/threads, sockets
- Drivers - interface to hardware
- Hardware
How does the computer communicate with IO devices?
Via busses
What are busses?
The way to connect to IO devices
Advantages of busses
- Versatility - easy to add new devices and move them between computer systems
- Low cost - share a single set of ways in multiple ways