Flashcards
Operating Systems - Part 1 & 2
Flashcards do conjunto (32)
- 1What do computers consist of? 4Processor(s), Main memory, disk, various input/output device/interfaces
OS manages these components - 2What is an Operating systems 2 main functions?- Extended (or virtual) machines
o Abstraction of the underlying hardware and more useable machine
- Resource manager: allows multiple programs to run at same time. Device and memory management: manage and protect memory, I/O devices and other resources. Share: time and space. - 3OS kernelkernel is core of os: layer that mediates and controls access to hardware and system wide resources.
- 4OS Interface: Kernel/os provides programmable interface to layers above: 2- Generic systems interface that application programmers use: often abstraction of OS and hardware eg POSIX
- OS specific kernel interface: privileged operations for standardized systems interface operations are wrappers. Eg read systems call to read from a file will call disk operations at kernel interface. - 5Monolythic OSall OS layers in kernel – single binary library applications link to.
Problem: kernel operations have system-wide consequences: can impact whole system including applications. Bugs in kernel bring whole system down. Bug in an audio driver accessed by media player can crash whole system including unrelated applications. - 6Microkernel OSput as little as possible in kernel – more reliable. Split OS into small, well-defined modules. Run only essential modules in kernel mode (ie microkernel for process management, IPC…) Bug in audio driver will garble sound not system. Device drivers, filesystem are separate user mode processes.
- 7monolithic vs microkernelmonolithic like a stack microkernel in a row
- 8The Process Model: central os concept. The abstraction of a running program: 4- a process is a program in execution
- Many processes can run same program text
- Each process has own address space (isolation)
- A (parent)process can create/fork (child)proceses
note: Provide (pseudo) concurrent operation even on single CPU - 9Independent sequential processeach process has own program counter, registers and variables and flow of control. To run process copy logical pc into real physical pc. When switch, value of physical pc is stored in process’ logical program counter in memory.
- 10Processes over timeover long period all processes make progress – at any given instance only one active (single cpu). CPUs switch rapidly between processes. Rate of progress is not uniform, predictable or reproducible. Cannot make assumptions about timing.
- 11ProgramProgram: algorithm expressed in a programming language or other notation
- 12ProcessProcess: activity executing on a processor. Has binary program text, input , output, state…
- 13Interrupt and switchinganother process requires CPU. Save state of current process. Swith to other process (must have higher priority or next in line) with own program and state. 2 distinct processes may execute the same program
- 14Os shares processor time between processes. Process blocks for I/O allowing another process to use CPU. Long computation is divided up and suspended every now and then to give other processes a share of CPU. Suspended processes must restart in exactly same state:OS saves address space (core image) and maintains a process table entry for each process with info about resources it is using (memory locations, open files…)
- 15what resources does OS maintain for each process? 5..registers incl pc and stack pointer, open files, outstanding alarms, list of related processes…
- 16OS allocates a private address space to each process isolated from other processes: Memory locations the process can read and write:executable program test, program data, stack, dynamically allocated memory, runtime environment.
- 17Processes and memory layout modelProgram arguments and envrionment
Stack - procedure calls - goes down
Heap - goes up- dynamically allocated
unitialised data
initialised data (gloabl/static variables)
text - prgoram code - 18stackStack: automatic (objects only exist for enclosing scope), managed by OS – compile time (determined by executation trace)
- 19HeapHeap (dynamic memory): flexibility – for what cannot be known until runtime and what cannot fit on the stack: more costly and more error-prone (programmer requests allocation and deallocation)
- 20Processes have a lifecycle managed by OSfrom creation to termination through intermediate state. IN simple systems all processes are created at system startup. In general-purpose systems need to create and terminate processes during system operation.
- 21System inittialisationSystem initialization: foreground processes ie ui. Background processes ie web server – daemons (??-see lecture)
- 22Execution of a process creation system call by a running process ie creating multiple processes User request to create a new process: typing command or double clicking icon Process termination - 2 typesVoluntary- under control of process or Involuntary – outside control of process
Normal exit and error exit are voluntary. Fatal error and killed by another process is involuntary - 23High level process abstrationview whole system as processes: structure system in terms of transitions between process states. Abstract away from low level interrupts from hardware ie key entered at keyboard) – OS turns them into process lifecycle events as part of process scheduling.
Some processes perform user tasks. Other perform system taks. Scheduler manages interrupt handling, starting, pausing and stopping processes. - 24Process treesProcess trees: processes create (fork) other (child) processes. Ie editor from command line shell. Related processes often need to communicate and share data (need IPC)
- 25Go overProcesses and scheduling
- 26Process states and transitionsStates: Running, Blocked, Ready
- 27Implementaiton of processesImplementation of processes: independent sequential process 0 1 --- n-2 n-1 underneath scheduler and then I/O devices generating interrupts. Scheduler needs process information.
- 28Processes and memory and kernel / model of implementation:2d array with position for each process. Each process gets own array of slots of memory (1 byte per slot). Its address space cannot access another process address space. Can only access own array. Kernel accesses whole 2d array (privileged access). OS maintans a process table that represents this model.
- 29Process table ?typical fields
managment fields
memory manamgnet
file managment - table go over? - 30Typical system startupsmall bootstrap program loaded from first sector of active disk partion which in turn loads the boot program. Boot program looks for multipart boot image (OS image) on partition – individual parts loading into specific locations in memory. Kernal starts process initialization:
- OS may be single process performing all tasks (monolithic) or collection of processes (hybrid to microkernel with application level OS processes) Core tasks ie scheduling. Higher level tasks ie device drivers, process management, filesystem, networking.
Final stem: start application level process to make system usable ie shell and/or ui - 31Process managmeent system callsPOSIZ defines standard API for os calls and related utility programs. System interface to process management, filesystem…
pid = fork() – create child process identical to parent
s = execve(namve, argv, envrionp) – replace process’ core image
pid = waitpid(pid, &stat, options) – wati for child to terminate
exit(status) – terminate process execution and return status - 32Monolithic vs Microkernel: 3Microkernel – more efficient. Security better. Less system calls to hardware. Monolithic calls expensive.
Informações
- Descrição
- Uni Uni Second Level (Software Systems) FlashCards sobre Operating Systems - Part 1 & 2, criado por HRYN red em 16-12-2024.
- Criado por
- HRYN red
- Visualizações
- 4
- Avaliação