Fichas
GIOS Spring Midterm Flashcards

Fichas del conjunto (189)
- 1What is a system call?When the operating system gives privileged access to an application such as malloc, send, and open.
- 2What is the flow of a system call?

- 3To make a system call, an application must:1. Write arguments
2. Save relevant data at well defined location
3. Make system call - 4What is synchronous mode?When the process waits until the system call is completed before continuing.
- 5What is a user/kernel transition?A necessary step for applications to perform access to certain types of hardware or changes to hardware resources. Only the OS can perform these types of operations.
- 6What is a trap instruction?When an application from unprivileged mode tries to perform instructions/memory access from which it doesn't have permissions. For example, an application can't give itself more memory.
- 7What is the special privilege bit?A bit located in the CPU that determines whether or not a process is ran in privileged or user mode.
- 8What determines the outcome of a trap instruction?The policies of an operating system. A trap instruction can either be granted access or terminated.
- 9What are the downsides of a user/kernel transition?Overhead (time) and the transitions impact the hardware cache. The hardware cache is very important in determining performance of the application.
- 10How does the OS provide applications to the underlying hardware?By exporting a number of services. They are directly linked to some of the components of the hardware.
- 11What are examples of components of the hardware?1. Scheduler - controls access to the CPU(s)
2. Memory manager - allocates underlying physical memory to one or more corunning apps
3. Block device driver - responsible for access to block device like disk - 12What are examples of OS services?1. Process management
2. File management
3. Device management
4. Memory management
5. Storage management
6. Security - 13How are operating systems made available to applications?System calls
- 14On Linux, the system call to send a signal to a process is...kill
- 15On Linux, the system call to set the group identity of a process is...setgid
- 16On Linux, the system call to mount a file system is....mount
- 17On Linux, the system call to read/write system parameters issysctl
- 18What is a monolithic OS?When every possible service that any one of the apps can require or that any type of hardware will demand is already part of the OS.
- 19What is the benefit of a monolithic OS?1. In-line, compile time optimizations
2. Everything included - 20What are the cons of a monolithic OS?1. Large size (large memory requirements which impacts performance)
2. Hard to debug/upgrade - 21What is a modular OS?More common than monolithic. Everything can be added as a module (allows for customization)
- 22How is a modular OS possible?The OS specifies certain interfaces that any module must implement to be part of the OS.
- 23What are the benefits of a modular OS?1. Easy to maintain
2. Smaller footprint
3. Less resource needs - 24What are the cons of a modular OS?1. Indirection (must go through interface before going to implementation which can reduce some opportunities for optimizations)
2. Maintenance can still be an issue as modules may come from completely different code bases - 25What is the microkernel?Only require the most basic primitives at the OS level. Can represent some basic services to represent an executing application (a thread).
- 26Threads can be supported on what levels?Kernel & User Level
- 27True/False - The OS Kernel is multithreadedTrue
- 28How is the OS able to use multithreading?OS Kernel maintains thread abstraction, and it performs scheduling, synchronizations to allow threads to share physical resources
- 29What does the user level library do to link the application to the kernel?Supports data structures that needed to implement the thread abstraction. Different processes may use different level libraries that have different ways to represent threads.
- 30How can user level threads be mapped to the underlying kernel?One to One
Many to One
Many to Many - 31Where is the state of a process data stored?It's process control block
- 32How does a user level library represent threads?A user level thread data structure which contains information such as thread ID and thread stack
- 33Why is the process control block split up during multithreading?To separate the information that is specifically useful to represent the execution state of the kernel level thread.
- 34What does a process control block split into for threaded programming?A PCB and a kernel level thread. The Kernel level thread contains the stack and registers whereas the PCB keeps the virtual address mapping
- 35What UNIX commands are used when saving and restoring the context of a user level thread?Setjump and Longjump
- 36What does a process control block consist of?Virtual address mapping, stack, and registers
- 37For multiple processes you will need multiple copies of user level threads, process control blocks, and kernel level threads.True
- 38What are thread related data structures?User level thread
Process control block
Kernel level thread - 39User level threads within the threading library have a direct relationship with a kernel level thread.False - User level threads have a direct relationship with the process control block
- 40A process control block has a direct relationship with kernel level threadsTrue
- 41If there are multiple CPUs, what must be done to manage threads?A data structure is needed to represent the CPU which has a relationship retained with the kernel level threads.
- 42When the kernel itself is multithreaded, we can have multiple kernel level threads supporting a single level user processTrue
- 43In the process it will save the entire PCB of the first kernel level thread and then if it context switching to the second one, it will restore the entire PCB of the second one.True
- 44When two kernel level threads belong to the same address space, there is actually information in the PCB that is relevant to the entire process. However there is info here that is specific to just one kernel level thread.True - information such as system call arguments or signals
- 45When context switching between two kernel level threads there are portions of the PCB that is specific to the KLT and depends on what user level thread is currently executing.True
- 46What is a hard process state?The virtual address mapping from the PCB (PCB is split)
- 47What is a light process state?Only relevant for a subset of user threads that are associated with a particular kernel level thread such as signal mask and system call arguments. (PCB is split)
- 48What is the rationale for multiple data structures when working with threads?Improves scalability, reduces overhead, improves performance, and improves flexibility
- 49What are the properties of a single process control block?Large continuous data structure
Private for each entity
Saved and restored on each context switch
Update for any changes - 50What are the properties of using multiple process control blocks/data structures?Smaller data structures
Easier to share
On context switch save/restore only what needs to be changed
User level library only needs to update a portion of the state - 51What is the name of the kernel thread structure (C structure) in Linux?kthread_worker
- 52What is the name of the data structure contained in the above structure that describes the process the kernel thread is running?task_struct
- 53In Sun's Solaris 2.0, what happens when a thread is created?A thread ID is created that returns a thread ID but it is not a direct pointer to the actual thread data structure but instead an index in a table of pointers which point to the actual thread data structure
- 54Why is it useful to use a table for storing user level threads (Sun Solaris Threads)Because if a thread goes wrong, it isn't a direct pointer to a thread but instead an ID which can be useful for debugging.
- 55What is the purpose of the "red zone"It is a range of memory addresses allocated on the stack that refers to space not allocated. If a thread tries to write into a thread that falls into this red zone region, the OS will show a fault and it will allow you to easily debug where the error occurred.
- 56What is a process in a kernel level data structure in Solaris 2.0?List of kernel level threads
Virtual address spaces
User credentials
Signal handlers - 57What is a light weight process data in a kernel level data structure in Solaris 2.0?Contains information that is relevant for a subset of process such as:
User level registers
System call arguments
Resource Usage Information
Signal Mask
It's similar to a user level thread but it's vicible to kernel and not needed when process not running - 58What are kernel level threads in a kernel level data structure in Solaris 2.0It includes kernel level information such as:
Kernel level registers
Stack pointers
Scheduling Info
Pointers to associated lightweight process, address space, cpu structures
Information needed even when process not running (now swappable!) - 59What are the kernel level data structures in Solaris 2.0?Process
Lightweight process
Kernel Level threads
CPU - 60What is the CPU data structure in solaris 2.0?Has information like:
Current thread
List of kernel level threads that ran there
Dispatching & Interrupt handling info - 61What happens when process starts?Kernel gives a default # of kernel level threads and process requests additional kernel level threads.
- 62What is the system call to create additional kernel level threads?set_concurrency
- 63True/False - The user level library knows what is happening in the kernelFalse - It does not know.
- 64How can the kernel/user level threads communicate?The kernel level thread sends notification signals to the user whereas the user communicates via system calls to the kernel to get more light weight processes/kernel level threads.
- 65True/false - The kernel knows about what's happening in the user level libraryFalse - the kernel does not know
- 66In the pthreads library, what function sets the concurrency level and what is the concurrency value to manage the concurrency level as it deems appropriate?pthread_setconcurrency()
0 - 67What can the kernel see?Kernel level threads
CPUs
Kernel level scheduler - 68What can the user level library see?User level threads
Available kernel level threads - 69A user level thread is [BLANK] to a kernel level threadbound
- 70A cpu bound to a kernel level thread is called [BLANK]thread pinning
- 71True/False - Mutex variables and wait queues are visible to the kernelFALSE
- 72When does a process jump to a user library scheduler?User level thread explicitly yield
Timer set by user level library expired
User level threads call library functions like lock/unlock
Blocked threads become runnable
From timer or kernel - 73Can kernel threads on different CPUs communicate?No - cannot modify registers on one CPU when executing on another
- 74How do threads on different CPUs communciate?Send some kind of signal/interrupt from the context of one thread on one CPU to another thread on another CPU to execute the library code locally bc the library needs to make a scheduling decision
- 75What is the minimum number of threads to allow a Linux system to boot?20
- 76What is the Linux command used to set the maximum number of threads?max_threads
- 77What are interrupts?Events generated externally to a CPU by components other than the CPU. Present a notification to CPU that some event occurred (such as I/O devices)
- 78What does an interrupt depend on?The physical platform.
- 79Are interrupts synchronous or asynchronous?Asynchronous
- 80What are signals?Events that are triggered by software that is running on CPU.
- 81What determines a signal?The OS
- 82Do signals appear synchronously or asynchronously?Both asynchronous and synchronous
- 83How are interrupts and signals similar?Both have a unique ID (respectively hardware/OS)
Can be masked and disabled/suspended via corresponding mask (interrupts is per CPU and signals are per process)
If handled, trigger corresponding handler - 84How are interrupts handled?In the past it was dedicated wires. Today there is a special message called "message signal interruptor" that is on the same wire that connects devices to the CPU (such as PCIE express). The interrupt number is passed into a table where it is looked up to see what the start address of the handler is.
- 85Where are interrupts handled?In the context of the thread which was interrupted
- 86How are signals handled?OS defined signal handler for each process in the system which keeps starting address of handling routine.
- 87What are some default actions for handling signals?Terminate, ignore, terminate and core dump, stop or continue
- 88Can a process install it's own custom handler?Yes, they can be done through system calls. There are exceptions
- 89What are masks?A sequence of bits where each bit correspond refers to a specific interrupt or signal and the value 0/1 determines whether or not it is enabled.
- 90Why disable interrupts or signals?To avoid deadlocks (for example, a mutex may be shared in a handler and process)
- 91Where are interrupt masks maintained?On a per CPU basis - if a mask disables a particular interrupt the hardware interrupt will not deliver interrupt to CPU
- 92Where are signal masks maintained?On per execution context (user level thread on top of kernel level thread). If mask disables signal then the kernel sees mask and will not interrupt corresponding thread.
- 93Where are interrupts directed on multicore systems?To any CPU that has them enabled / set
- 94What are the types of signals?One shot signals and real time signals
- 95What are the properties of a one shot signal?If multiple instances of the same signal that will occur, they will be handled at least once.
Handling routine must be explicitly re-enabled every time - 96What are properties of a real time signal?If n signals raised, then handler is called n times
- 97Linux signal name for terminal interrupt signalSIGINT
- 98Linux signal name for high bandwidth data is available on a socket signalSIGURG
- 99Linux signal name for background process attempting writeSIGTTOU
- 100Linux signal name for file size limit exceededSIGXFSZ
- 101Why use interrupts as threads?To prevent deadlocks (IE, a mutex on a separate thread has it's own stack and will not block the original thread)
- 102True/False - Dynamic thread creation is not expensiveFalse - it is expensive
- 103What is the top half of an interrupt?Occurs immediately when interrupt occurs which performs a minimum amount of processing and is non blocking (fast)
- 104What is the bottom half of an interrupt?Performs arbitrary types of operations (complex) and is not restricted on when it is able to be executed (due to certain timeouts tied to the device)
- 105What roles and functionality does an OS provide?Hide hardware complexity from applications and developers
Manages the underlying hardware
Provides isolation and protection - 106Where can threads exist?On the kernel and user level
- 107What are some examples of components of an OS?Kernel
File System
Device Drivers - 108An OS _____ and _____ the use of a computer systemABSTRACTS
ARBITRATES - 109Distributing memory between multiple processors is an example of ________Arbitration
- 110Supporting different types of speakers is an example of __________Abstraction
- 111What is an embedded operating system?A type of operating system designed to be compact, efficient at resource usage, and reliable (such as for a smart phone/tablet).
- 112What are examples of UNIX based OS?Max OS X
Linux
Android - 113Which of the following is an example of abstraction? Socket, Create, Schedule, WriteSocket
- 114Which of the following is a mechanism? Schedule, Process, File, THreadSchedule
- 115How does an OS achieve it's goals?OS supports a number of higher level abstractions and then a key number of mechanisms that operate on top of these abstractions.
- 116OS implement ________ to determine how mechanisms will be used to manage the underlying hardwarePolicies
- 117The policy Least Recently Used (LRU) decides that the pages that have been least recently used over a period of time are the ones that are no longer used in physical memory but instead to be used on disk. This is also known asSwapping
- 118What are some good guiding policies when designing an OS?Separation of mechanisms and policy
Optimize for the common case - 119To achieve it's role of controlling and managing hardware resources on behalf of applications, the application must have special privileges. This is achieved by distinguishing between at least two modes ofKernel & User
- 120The OS must operate in what mode?Privileged kernel mode
- 121User - Kernel switch is supported by which hardware?The CPU
- 122What is a trap instruction?When an application attempts to perform privileged operations in user mode
- 123What happens when a trap instruction occurs?Control is switched to the OS at a specific location
The OS checks to see what caused the trap to occur
Grant access or perform terminate the process if the instruction was illegal. - 124An OS is a layer of systems software that:Directly has privileged access to the underlying hardware
Hides the hardware complexity
Manages hardware on behalf of one or more apps according to predefined policies
Ensures that apps are isolated and protected from one another - 125Distributing memory between multiple processes is an example of __________Arbitration
- 126Interchangeable access of hard disk or SSD is an example of ____________Abstraction
- 127What are the elements of an OS?Abstractions, mechanisms, and policies
- 128What are examples of abstractions?Process, thread, file, socket, memory page
- 129What are examples of mechanisms?Create, schedule, open, write, allocate
- 130What are examples of optimizing for the common case?Where the OS will be used
What the user will want to execute on that machine
What the workload requirements are - 131User kernel switch is supported by ________Hardware
- 132True/False: User kernel transitions are expensiveTrue: affects the hardware cache which impacts the applications performance
- 133Microkernel is an example of ______OS design
- 134The microkernel consists ofThe OS
The Address Space
Threads
Everything else (database, file system, disk drivers are on the user level) - 135What are the benefits of a microkernel?It's very small which allows you to more easily verify that it is performing properly
- 136Where are micro kernels common?Embedded Devices
Certain Control Systems - 137What are the negatives of a microkernel?Lacks portability
Increases complexity of software development
Cost of user/kernel crossing - 138What is the order of the Linux OS?Users (UI)
Standard utility programs (shell, editors)
Standard library (open, close, read, write)
Linux OS (process/memory mgmt)
Hardware (CPU, memory, disks) - 139What is the order of Mac OS architecture?GUI (Aqua)
Application Environment/Services (Java/ Cocoa, quicktime, bsd)
Kernel Environment (at core is Mach microkernel)
IO Kill/Kernel Extensions - 140What is a process?An instance of an executing program. It can also be called a "task" or "job"
- 141A process consists of...A state of execution (program counter, stack pointer)
Parts & Temporary holding area (data, register state occupies state state in memory)
May require special hardware (I/O Devices) - 142What is an application?A program on disk, flash memory that is not executing (it is a static entity)
- 143What is an application when it's launched?A process / app loaded in memory (active entity)
- 144What does a process look like?(Vmax) Stack -> <- Heap
Data
Text (V0) - 145What are the types of state in a process?Text and data - static state when process first loads
Heap - dynamically created during execution
Stack - grows and shrinks (LIFO queue) - 146What is a process representation (the stack growing towards heap, data, and text) referred to as?An Address Space (in memory representation of a process)
- 147What is the name of what is between V0 and VMax in a process?Virtual Addresses used by a process
- 148Why are they called virtual addresses?They don't have to correspond to physical addresses located in physical memory. Instead, page tables contain a mapping of virtual to physical addresses
- 149What does a page table entry consist of?A virtual address mapped to a physical address
- 150True/False - All parts of virtual address spaces need to be allocatedFalse - they might not need to be
- 151How does the OS handle not having enough DRAM for all process states?The OS dynamically decides which portion of which address space will be present in physical memory
- 152When a portion of a process is not being used, where would it be swapped?From DRAM to Disk and vice versa when it needs to be used
- 153What must the OS do for each process?It must maintain some information regarding the process address space. It uses this info to maintain mapping btw virtual / physical addresses.
- 154How does an OS know what a process is doing?Program counter
CPU registers
Stack pointer - 155How do items go out of the stack?Last In First Out
- 156What does an OS maintain to contain all of the necessary information for a process?A process control block
- 157What is a Process Control Block?A data structure that the OS maintains for each process that it manages
- 158When is the PCB created and initialized?When a process is created
- 159The program counter changes on _________every single instruction
- 160When are certain fields updated in the PCB?When the process state changes
- 161How is the program counter handled?The CPU has a dedicated register which is used for tracking (updated on every instruction)
- 162What is a context switch?Each time the OS performs a swap between processes
Formal definition: switching the CPU from the context of one process to the context of another - 163Why is context switching expensive?Direct costs (# of cycles to be executed to load & store instructions)
Indirect Costs - Cold cache, cache misses - 164Is it faster to process on the cache or memory?Much faster on the cache
- 165What is a hot cache?When the data we need for a process is present in the cache
- 166What is a cold cache?When the data we need for a process is not present in the cache. Need to get the data needed from execution from memory
- 167True / False : We want to limit the frequency for which context switching is doneTrue
- 168Do we need to ever context switch for a hot cache?Yes, sometimes because there may be another process with higher priority or there is a policy to time share a CPU between processes
- 169What are the two possible states of a process?New, Ready, Running, Waiting, Terminated
- 170What states can the CPU execute a process in?Ready and Running
- 171What are the mechanisms for process creation?Fork and Exec
- 172What is a fork?Copying the parent PCB into the child PCB. Child continues execution at instruction after fork
- 173What is an exec?Replace child process image that was created from the fork command
Loads new program and start from first instruction.
You must call fork before you can call exec (it creates the initial process) - 174On UNIX based OS, which process is often regarded as the parent of all processes?init (first process when the system boots)
- 175What is the role of the CPU scheduler?Decides which one of the ready processes will be dispatched to the CPU next and for how long
- 176To manage the CPU the OS must...Preempt - save current context
Schedule
Dispach - switch into it's context
MUST BE EFFICIENT!!! - 177What is the formula for useful CPU work?Total Processing Time / Total Time
- 178What is the timeslice?Time Tp (total processing time) allocated to a process on the CPU
- 179What are some scheduling design decisions?What are appropriate time slice values
Metrics to choose next process to run - 180How can a process get into a ready queue?I/O request
Expired Time Slice
Forking of child
Waiting for an interrupt - 181What are responsibilities of the CPU scheduler?Deciding when to context switch
Maintaining the ready queue - 182True / False : Processes can interactTrue
- 183How do processes interact?Inter process communication mechanisms
- 184What do inter process communication mechanisms do?Allow communication between processes by:
Transfer data/info between addresses
Maintain protection and isolation
Provide flexibility and performance - 185What are examples of IPC mechanisms?Message-passing IPC - OS provides communication (shared buffer)
Shared memory IPC - OS establishes shared channel and maps it into each process address space - 186What are pros/cons of message-passing inter processing communication?+ OS Manages
- Overheads - 187What are pros/cons of shared memory IPC?+ OS is out of the way
- More error prone (sometimes need to reimplement code) - 188When does it make sense to use shared memory based communication over message passing communication?When the actual operation of mapping memory between two processes can be split between a sufficient amount of messages.
- 189—
Información
- Descripción
- Fichas sobre GIOS Spring Midterm Flashcards, creado por Daniel Marshall el 13/02/2021.
- Creado por
- Daniel Marshall
- Visitas
- 4
- Valoración