COMPSCI 377 Lecture Notes - Lecture 3: System Call, Exception Handling, Fifo (Computing And Electronics)
Document Summary
How to efficiently virtualize the os with control. + just running the program directly to the cpu. + set up memory, registers, stack pointer, process, then run the program, and finally free memory and delete the process. + cons: os does not know weather what is okay to run. + cons: os need to share cpu processing with many processes to virtualize cpu. User mode (least privileged) to kernel mode (most privileged) System calls allow users to perform privileged actions. Allow access to file systems, creating and communicating with processes, allocating memory, etc. Executing a system call causes a trap instruction to form. +switch to kernel mode raise privilege level simultaneously. After execution, a return to trap instruction is performed. +returns to user mode and lowers privilege level simultaneously. Generally traps are similar to interrupts but the original program still runs. Traps save the state of the user processes by pushing pc, flags, and registers into the kernel stack.