GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

UNR CS 646 Spring - Operating Systems Flashcards for midterm

Ty Jones Principles of Operating Systems - Spring 2023 MSCS Englisch 65 Karten

Karten in diesem Stapel (65)

  1. 1What is an operating system, and what are it's two main roles/purposesa software that manages computer hardware and software resources and provides common services for computer programs. Its two main roles/purposes are to manage the computer hardware resources and to provide an environment for the execution of applications.
  2. 2What does an operating System Manage? Provide an example of each.An operating system manages various resources of a computer system, including the central processing unit (CPU), memory, input/output devices, and file systems. For example, the OS manages the allocation of memory to processes and files, scheduling the CPU, and managing input/output operations.
  3. 3What is virtualization? What portions of the OS is it associated with?Virtualization is a technology that allows multiple operating systems or applications to run on a single physical machine. It is associated with the kernel space of the OS.
  4. 4What is concurrency? What is entailed in allowing an OS to be concurrent?Concurrency is the ability of an operating system to handle multiple tasks or processes at the same time. To allow an OS to be concurrent, it needs to provide mechanisms for process synchronization, inter-process communication, and resource sharing.
  5. 5What is persistence? What is its role in ease-of-use?Persistence refers to the ability of an operating system to store data and settings between system restarts. It plays an essential role in ease-of-use by allowing users to resume their work where they left off without having to start from scratch.
  6. 6What security does the operating system control?The operating system controls various security aspects, including user authentication, access control, and process isolation.
  7. 7How many processes can be executed at once on a single CPU?The number of processes that can be executed at once on a single CPU depends on the CPU's processing power and the operating system's scheduling algorithms.
  8. 8Compare the 3 different operating system types discussed in class, and give 1 real world example of eachBatch OS: Batch OS processes a large number of similar jobs in a batch. An example is the IBM OS/360.
    Server OS: Server OS manages networked resources and provides services to clients. An example is Microsoft Windows Server.
    Embedded OS: Embedded OS is designed for specific hardware devices with limited resources. An example is Android OS for smartphones.
  9. 9What are the 6 major goals of every operating system?The six major goals of every operating system are:
    Resource allocation: The OS should manage and allocate computer resources effectively.
    Process management: The OS should manage and schedule processes efficiently.
    Memory management: The OS should allocate and manage memory effectively.
    Device management: The OS should manage input/output devices and provide a consistent interface to them.
    Security: The OS should provide secure access to the system resources and protect against unauthorized access.
    User interface: The OS should provide an intuitive and user-friendly interface. processes
  10. 10What is the shell, and how is it related to system calls?The shell is a user interface that allows users to interact with the operating system. It is related to system calls because it provides a command-line interface for users to execute system calls.
  11. 11Compare and contrast kernel space and user spaceKernel space and user space are two modes in which an operating system executes code. Kernel space is a privileged mode that has direct access to the hardware and can execute all instructions. User space is a non-privileged mode that can only execute a subset of instructions and cannot access the hardware directly.
  12. 12What is the difference between and operating system and the kernel?The kernel is the core of the operating system that manages system resources and provides essential services. The operating system is the software that manages the hardware and software resources and provides a platform for applications to run.
  13. 13What is the difference between a process and a program?A program is a set of instructions that can be executed by a computer, while a process is an instance of a program that is being executed by the operating system.
  14. 14What does every process have to define before execution?Every process has to define its address space, which is the memory range that the process can access and use.
  15. 15What are the two ways processes share resources? Which portions of the OS are associated with each?The two ways to share resources are through inter-process communication (IPC) and through shared memory. IPC allows processes to exchange information and synchronize their actions, while shared memory allows multiple processes to access the same memory region. Both IPC and shared memory are associated with the kernel space of the OS.
  16. 16What are the basic steps that happen when an operating system abstracts a process?Allocates memory for the process
    Loads the executable code and data into the process's memory
    Initializes the process's data structures, including the process control block (PCB)
    Sets up the process's environment, including the command-line arguments and environment variables
    Starts the process by setting its initial state to "ready" and adding it to the scheduling queue
  17. 17What are the process states? Which states can be transitioned to from a specific state?New: The process is being created.
    Ready: The process is waiting to be assigned to a processor.
    Running: The process is being executed by a processor.
    Blocked: The process is waiting for some event to occur (such as I/O completion or a signal).
    Terminated: The process has finished executing.
    A process can transition from the ready state to the running state when it is selected by the scheduler. It can transition from the running state to either the blocked or ready state, depending on whether it needs to wait for some event or can continue executing. It can transition from the blocked state to the ready state when the event it was waiting for occurs.
  18. 18What is the purpose of the CPU idle process?A process is an instance of a program that is being executed by the operating system, while a thread is a lightweight process that shares the same memory space as the parent process. A process can have multiple threads, and each thread can execute concurrently and independently of the other threads within the same process. Threads share the same process state and resources, while processes have their own independent memory and resource allocation.
  19. 19What is the difference between a process and a thread?A process is a running program that has at least one thread running. Each thread has its own stack. But shares the data, code, & heap with every other thread within the process.
  20. 20Compare and contrast the Round Robin scheduling algorithm with the Completely Fair Scheduling (CFS) algorithm and the Multi-Level Feedback Queue algorithm. What type of system uses these algorithms? What are the potential benefits and drawbacks to each?The Round Robin scheduling algorithm, Completely Fair Scheduling (CFS) algorithm, and Multi-Level Feedback Queue algorithm are all process scheduling algorithms used in operating systems.
    Round Robin scheduling assigns a fixed time slice to each process and switches between them in a circular fashion. CFS assigns priorities based on process usage and schedules the process with the smallest amount of usage. Multi-Level Feedback Queue assigns priorities based on the age of the process and dynamically adjusts priority levels based on the behavior of the process.
    Each algorithm has its own benefits and drawbacks. Round Robin ensures that every process gets an equal amount of CPU time, but can lead to low CPU utilization and high response time. CFS is fair and efficient, but can be complex to implement. Multi-Level Feedback Queue is adaptable and efficient, but can be complex and difficult to fine-tune.
  21. 21Compare and contrast the Shortest Job First scheduling algorithm with the Shortest Remaining Time Next scheduling algorithm. What type of system uses these algorithms? What are the potential benefits and drawbacks to each?Shortest Job First scheduling (SJF) and Shortest Remaining Time Next (SRTN) scheduling are both process scheduling algorithms used in operating systems.
    SJF schedules processes in order of their expected CPU burst time, with the shortest job being executed first. SRTN is a preemptive version of SJF that selects the process with the shortest remaining burst time for execution.
    SJF can minimize average wait time and turnaround time but requires knowledge of the expected CPU burst time, which may not be available. SRTN can minimize waiting time and response time, but has a potential for starvation.
  22. 22What is the tradeoff between creating processes in the user space, versus creating them in kernel space? Consider both time and space.Creating processes in user space can be faster and requires less overhead than creating them in kernel space because user space processes do not require the intervention of the operating system. However, user space processes have limited access to system resources and may not be as secure as kernel space processes. Creating processes in kernel space allows for greater control and access to system resources but is more expensive in terms of time and overhead.
  23. 23What is the purpose of a process scheduling algorithm? How is it related to the process table?The purpose of a process scheduling algorithm is to allocate the CPU resources among multiple processes to optimize system performance. The process scheduling algorithm is related to the process table because the process table contains information about each process, including its state and priority, that is used by the scheduling algorithm to determine which process should be executed next.
  24. 24True or False? On a machine with a one CPU containing a single core, we can only run one process at a time.True. On a machine with one CPU containing a single core, only one process can execute at a time. However, the operating system can switch between processes quickly, giving the illusion that multiple processes are running simultaneously.
  25. 25True or False? Context Switching allows a CPU to swap from process A to process B, and then return to the exact same place in instructions for process A after executing process B.True. Context switching is a mechanism that allows a CPU to switch from one process to another. When a context switch occurs, the CPU saves the current context of the running process, which includes the value of program counter, registers, and other relevant data. Then, it loads the context of the next process to be executed and resumes execution from the point where that process was previously interrupted. Thus, when the CPU returns to process A after executing process B, it resumes execution from the exact same place where it left off.
  26. 26True or False? init is always the last process to be run at boot.False. Init is the first process to be run when a Linux system boots up, and it is responsible for starting all other processes. It is not the last process to be run, but rather the first.
  27. 27What is a trap instruction, and why is it useful when a user needs to escalate privileges?A trap instruction is a software interrupt that is triggered by a program when it needs to perform a privileged operation, such as accessing hardware or performing a system call. When the trap instruction is executed, the CPU switches to kernel mode, and the kernel takes control of the system. The kernel then performs the requested operation on behalf of the program and returns control to the program.
    Trap instructions are useful when a user needs to escalate privileges because they allow a program running in user mode to request the kernel to perform operations that require elevated privileges. By using trap instructions, the program can remain in user mode and does not need to be executed with elevated privileges, which can help improve the security of the system.
  28. 28Compare and contrast preemption and context switching; when is one used over the other?Preemption and context switching are related concepts, but they serve different purposes. Preemption is a mechanism that allows the operating system to interrupt a running process to give CPU time to another process that has a higher priority. Preemption is used to ensure that high-priority processes can execute in a timely manner, even if lower-priority processes are still running.
    Context switching is a mechanism that allows the CPU to switch from one process to another. Context switching occurs whenever the operating system needs to interrupt a running process to allow another process to execute. Context switching is used to maximize CPU utilization and ensure that all processes get a fair share of CPU time.
    Preemption and context switching are often used together. When a high-priority process is scheduled to run, it may preempt a lower-priority process, causing a context switch to occur.
  29. 29How is average wait time calculated?wait time for each process is calculated as:
    Start Time - Arrival time
    Average wait time is calculated as:
    sum of all process wait times / # of processes
  30. 30How is average turnaround time calculated?Turnaround time for each process is calculated as:
    Completion time - Start Time
    Average turnaround time is calculated as:
    sum of all process turnaround times / # of processes
  31. 31Choose two operating system types (batch, multiprocessor, PC, embedded, real-time, or any other discussed in class) and compare and contrast them.Multiprocessor OS: Multiprocessor OS can run on multiple processors and can execute multiple processes in parallel. It provides better performance than single-processor systems.
    Real-time OS: Real-time OS is designed to respond to events in real-time and provides predictable performance. It is commonly used in embedded systems and control systems.
  32. 32What is a process? What are the three process states, and how do they communicate with each other?A process is an instance of a program that is being executed by the operating system. It includes the program's code, data, and resources, as well as information about its state and execution context. The three process states are:
    Running: The process is currently using the CPU.
    Blocked: The process is waiting for some event, such as I/O completion or a signal.
    Ready: The process is waiting to be assigned to a processor.
    Processes communicate with each other through inter-process communication (IPC), which can be either through shared memory or message passing. In shared memory, multiple processes can access the same memory region, while message passing allows processes to exchange information by sending and receiving messages.
  33. 33What is the difference between a parent and child process? If you are provided with a description of process relationships, you should be able to construct a process tree.In a multi-process operating system, a parent process creates a child process by duplicating itself. The child process inherits the parent's resources, such as memory space and file descriptors, and runs independently of the parent. The parent process can communicate with the child process through interprocess communication mechanisms, such as pipes or sockets.
    A process tree is a hierarchical representation of the relationships between processes in a system, with the parent-child relationship forming the basis of the tree structure. The root of the tree is typically the init process, which creates all other processes in the system.
    Constructing a process tree requires understanding the parent-child relationships between processes. Each process in the tree has one parent and zero or more children. By tracing the creation and termination of processes, you can construct a process tree that shows the relationships between all processes in the system.
  34. 34Compare and contrast swapping, paging, and segmentation. Provide at least one example of a situation where each is preferable.Swapping involves moving entire processes between main memory and secondary storage. This technique is typically used when there is a shortage of physical memory and the system needs to free up memory for other processes.
    Paging involves dividing physical memory into fixed-size chunks called pages and dividing processes into fixed-size chunks called page frames. Pages of a process are loaded into available page frames in physical memory when they are needed, and pages can be swapped out to disk when physical memory becomes full.
    Segmentation is a memory management technique that divides a process into logical segments, each with its own address space. Each segment can grow or shrink dynamically as needed.
    Swapping may be preferable is when a system is running many processes simultaneously, and there is not enough physical memory to hold all of them at once. Paging is preferable when the system needs to allocate and free memory dynamically as it is a more efficient use of memory resources. Segmentation is useful when the memory requirements of a process are complex.
  35. 35What is thrashing? Why is it bad? How do we prevent it?Thrashing is a condition where a computer system is constantly swapping pages between physical memory and disk, which can significantly degrade system performance. Thrashing occurs when the system does not have enough physical memory to hold all the pages it needs, and instead, it spends more time swapping pages than executing code.
    Thrashing is bad because it significantly slows down system performance and can make the system unresponsive. It also leads to a phenomenon called the "working set problem," where the set of pages that a process needs to execute effectively changes over time.
    To prevent thrashing, the operating system can use techniques such as increasing the amount of physical memory, reducing the number of processes running, and improving the efficiency of the page replacement algorithm used by the system.
  36. 36What is starvation?Starvation is a condition in which a process is unable to acquire the resources it needs to execute, even though the resources are available. This can happen when the operating system allocates resources to other processes in preference to the starved process, leading to the process being blocked indefinitely.
  37. 37Compare and contrast virtual and physical memory.Virtual memory is a memory management technique that allows processes to use more memory than is physically available on the system. The system uses disk space to create a virtual address space that processes can use, and only the parts of the address space that are currently being used are loaded into physical memory. Virtual memory provides several benefits, including the ability to run more processes simultaneously and the ability to run processes larger than physical memory.
    Physical memory, on the other hand, refers to the actual memory chips installed on the computer's motherboard. It is the actual physical memory that the CPU uses to store and retrieve data. Physical memory is limited by the number of memory chips and their size.
  38. 38What do we do if we want to execute a program that is too large to hold in physical memory all at once?When a program is too large to hold in physical memory all at once, we use a technique called demand paging. In demand paging, only the portions of the program that are currently needed are loaded into physical memory. When a portion of the program that is not in physical memory is needed, a page fault occurs and the required page is loaded from disk into physical memory. This allows the program to execute even if its size is greater than the physical memory available.
  39. 39Describe how paging handles page faults. Provide at least one example of a page replacement algorithm. What is the space-time trade off associated with paging?Paging is a memory management technique that allows the memory to be divided into fixed-size pages and the program is divided into the same-sized pages. When the program is executed, only the necessary pages are loaded into memory, while the other pages are kept in secondary storage such as a hard disk. When a page that is not present in memory is referenced, a page fault occurs. The operating system then fetches the required page from secondary storage and loads it into a free page frame in physical memory.
    One example of a page replacement algorithm is the Least Recently Used (LRU) algorithm. This algorithm replaces the page that has not been used for the longest time. The space-time tradeoff associated with paging is that the more pages that are kept in physical memory, the less page faults occur, but the more memory is required.
  40. 40Define each of the following page replacement algorithms: optimal, not recently used, first-in, first-out, second-chance, clock, least recently used, working set, or WSClock. Compare and contrast them as you defineOptimal: Replaces page that will not be used for the longest time in the future. Not practical: requires knowledge of future page references.
    (NRU): Divides pages into four categories based on their use and replaces a page in the lowest category. The categories are recently used and modified (RUM), (RUNM), (NRUM), and (NRUNM).
    (FIFO): Replaces page that has been in physical memory the longest.
    Second-Chance: Similar to FIFO but gives a second chance to recently used pages that would otherwise be replaced.
    Clock: Maintains circular list of pages and uses a reference bit to determine if a page has been recently used. When a page is replaced, the reference bit is set to 0 for all pages until a page is referenced again.
    Least Recently Used (LRU): Replaces the page that has not been used for the longest time.
    Working Set: Tries to keep track of the set of pages that a process is actively using and only replaces pages that are not in the working set.
    WSClock: Variation of the Clock algorithm that uses a combination of reference bit and age to determine which page to replace.
  41. 41Why is it a bad idea to not use any memory abstraction(virtualization) when designing an OS?Not using any memory abstraction when designing an OS can result in several problems, such as inefficient use of memory, lack of memory protection, and difficulty in managing memory. Without memory abstraction, it is difficult to manage different processes running concurrently in the system, and it can result in one process overwriting the memory of another process.
  42. 42What are the different methods of allocating memory to processes? Be sure to discuss the tradeoffs between each implementation.Contiguous memory allocation: Each process is allocated a contiguous block of memory.
    Three sub-methods:
    Fixed partitioning: The memory is divided into fixed partitions, each of which can hold a single process. Can lead to wastage of memory if a process is smaller than the partition it is allocated.
    Variable partitioning: The memory is divided into variable-sized partitions, which can be allocated to processes dynamically. Reduces wastage of memory but can lead to fragmentation.
    Buddy system: The memory is divided into blocks that are powers of two in size, and adjacent blocks are combined to form larger blocks when possible. Reduces fragmentation but can lead to wastage of memory.
    Non-contiguous memory allocation: The process is allocated memory that is not necessarily contiguous.
    Two sub-methods:
    Paging: Memory is divided into fixed-size pages, and each process is allocated the required number of pages. Allows efficient use of memory and reduces fragmentation, can lead to overhead due to page tables and page faults.
    Segmentation:
  43. 43What is the MMU, and how is it related to the TLB and paging?The MMU (Memory Management Unit) is a hardware component that is responsible for translating virtual addresses used by the CPU into physical addresses used by the memory subsystem. The TLB (Translation Lookaside Buffer) is a cache of recent translations stored by the MMU, which speeds up the translation process by avoiding the need to look up translations in the page table. Paging is a memory management scheme that uses page tables to map virtual addresses to physical addresses.
  44. 44What is caching?Caching is a technique used to speed up access to frequently used data. It involves storing a copy of the data in a small, fast memory (cache) that can be accessed more quickly than the original, larger memory (such as RAM or disk). When data is requested, the cache is checked first, and if the data is found, it is returned from the cache. This can significantly reduce access times and improve overall system performance.
  45. 45What is a page table? How is it used to manage memory?A page table is a data structure used by the operating system to map virtual addresses used by the CPU to physical addresses used by the memory subsystem. It contains entries that associate each virtual address with a physical address, as well as information about the state of the corresponding page (e.g., whether it is present in physical memory or needs to be fetched from disk). The page table is used by the MMU to translate virtual addresses into physical addresses.
  46. 46Compare and contrast internal and external fragmentation, and provide an example.Fragmentation refers to the phenomenon where memory is allocated into small, non-contiguous pieces, which can lead to inefficient use of memory. Internal fragmentation occurs when a process is allocated more memory than it needs, leading to wasted space within the allocated block. External fragmentation occurs when there is enough free memory to satisfy a memory request, but the memory is divided into small, non-contiguous pieces, making it unusable. An example of external fragmentation is when a process requests a large block of memory, but the available memory is divided into many small free blocks, none of which are large enough to satisfy the request.
  47. 47What is efficiency as it pertains to multiprogramming?Efficiency in the context of multiprogramming refers to the ability of a computer system to effectively utilize its resources to execute multiple processes concurrently. The goal of multiprogramming is to maximize the system's throughput, which is defined as the number of processes completed per unit time.
    Efficiency can be measured in terms of the utilization of the CPU, memory, and I/O devices. If the CPU is constantly idle due to lack of processes or waiting for I/O operations to complete, the system is considered inefficient. Similarly, if the memory is not being utilized to its full potential, the system may experience unnecessary page faults or thrashing, resulting in a decrease in performance.
    Efficiency can be improved by employing techniques such as process scheduling, memory management, and I/O scheduling. Effective process scheduling can ensure that the CPU is always utilized and processes are executed in an optimal manner. Memory management techniques such as paging and segmentation can help to reduce unnecessary page faults and optimize memory usage.
  48. 48Define each of the following: mutex, semaphore, busy wait, condition variable. Compare and contrast them each other. Be sure to discuss the advantages and disadvantages of each.Mutex: A synchronization primitive that is used to protect a shared resource from being accessed simultaneously by multiple threads or processes. It allows only one thread to acquire the lock and access the resource at a time. Can lead to deadlocks, where a thread is waiting indefinitely to acquire the lock that is held by another thread.
    Semaphore: A synchronization primitive that is used to control access to a shared resource. It allows a specified number of threads to access the resource simultaneously. Semaphores can be used to implement synchronization mechanisms such as mutexes and barriers. Can handle multiple threads accessing the shared resource at the same time.
    Busy wait: A synchronization technique in which a thread repeatedly checks a condition in a loop, while continuously using CPU time. Wastes CPU cycles and can lead to performance degradation.
    Condition variable: A synchronization primitive that allows a thread to wait for a specific condition, such as a shared resource becoming available. Avoids busy waiting and allows the thread to sleep until the condition is met.
  49. 49What is process synchronization, and why do we need it? Provide an example where synchronization is necessary.Process synchronization refers to the coordination of concurrent processes or threads to ensure that they work correctly and do not interfere with each other. We need process synchronization to avoid race conditions and ensure the consistency of shared resources. For example, in a bank transaction system, multiple threads may access the same bank account balance concurrently. Without proper synchronization, it can lead to incorrect account balances or transaction losses.
  50. 50What is inter process communication?Inter-process communication (IPC) refers to the mechanism used by different processes or threads to communicate with each other and share data. There are several IPC mechanisms, such as shared memory, message passing, pipes, and sockets.
  51. 51What is the tradeoff between creating threads in the user space, versus creating them in kernel space? consider both time and space.The tradeoff between creating threads in user space versus kernel space is mainly a tradeoff between time and space. User-level threads are faster to create and switch between, as they do not require any system calls, and can be managed entirely in user space. However, they cannot take advantage of multiple processors, and a blocking system call made by one thread can block the entire process. Kernel-level threads, on the other hand, can take advantage of multiple processors, and blocking calls made by one thread do not block the entire process. However, they require system calls to create and switch between threads, which are slower than user-level threads.
  52. 52What is the purpose of a process scheduling algorithm?The purpose of a process scheduling algorithm is to decide which process to run next on the CPU. The scheduling algorithm should ensure that the CPU is always busy and that each process gets a fair share of CPU time. The scheduling algorithm should also optimize system performance metrics such as turnaround time, response time, and throughput.
  53. 53What is a critical region? How is it related to process scheduling?A critical region is a section of code where shared resources are accessed and modified by multiple threads. It is critical because if two or more threads access and modify the same shared resource at the same time, the results may be unpredictable or incorrect. Process scheduling is related to critical regions because a process scheduler must ensure that two threads do not access the same critical region at the same time, or else there could be data corruption or other issues.
  54. 54What is the role of threading in concurrency?Threading enables concurrency by allowing multiple threads to execute concurrently within the same process. Threads are lighter weight than processes, so they can be created and destroyed more quickly, and they share the same memory space, which allows for efficient communication and coordination between threads.
  55. 55How are a thread and a process different? What do threads have shared access to, and what is not shared between threads?A process is an instance of a program that is executing, whereas a thread is a lightweight unit of execution within a process. Threads have shared access to the process's memory space, which includes global variables and shared data structures. However, each thread has its own stack and registers.
  56. 56What is the difference between a user thread and a kernel thread?A user thread is created and managed by a user-level threading library, while a kernel thread is created and managed by the operating system kernel. User threads are typically faster to create and switch between, but they may suffer from poor performance due to the lack of direct support from the kernel. Kernel threads, on the other hand, are slower to create and switch between, but they benefit from the scheduling and synchronization mechanisms provided by the kernel.
  57. 57What is parallelism and how is it different than multithreading?Parallelism involves the execution of multiple tasks simultaneously on multiple processing units. Multithreading, on the other hand, involves the execution of multiple threads within a single process.
  58. 58What is the basic thread API- that is, what are the various pthread methods we’ve used in class, and what do they do? You should be able to write a very basic bit of multithreaded code and understand what each component in that code does.The basic thread API includes functions for creating and joining threads, as well as functions for synchronizing threads using mutexes, condition variables, and semaphores. For example, the pthread_create function is used to create a new thread, while the pthread_mutex_lock and pthread_mutex_unlock functions are used to lock and unlock a mutex.
  59. 59What are the three multithreading models, and how do they work?The three multithreading models are:
    Many-to-One Model: This model maps many user threads to a single kernel thread, which is managed by the operating system. It is simple and efficient, but not suitable for CPU-bound applications or systems that require a high degree of concurrency.
    One-to-One Model: This model maps each user thread to a kernel thread. It provides better performance and concurrency, but can lead to resource exhaustion if too many threads are created.
    Many-to-Many Model: This model maps many user threads to many kernel threads, allowing the operating system to create a balanced ratio between the two. It is more flexible and scalable than the other two models but requires additional overhead for managing the threads.
  60. 60What is a race condition, and how do we avoid it?A race condition is a situation where the behavior of a program depends on the order of execution of two or more threads accessing a shared resource. To avoid it, we can use techniques such as locking, synchronization, and atomic operations to ensure that only one thread accesses the shared resource at a time.
  61. 61What is the producer consumer problem, and where is it useful in the CS world?The producer-consumer problem is a classic synchronization problem where there are two types of threads - producers and consumers - that share a common buffer. Producers add items to the buffer, while consumers remove items from the buffer. The challenge is to ensure that producers and consumers do not access the buffer at the same time and that the buffer does not overflow or underflow. This problem is useful in many areas of computer science, such as operating systems, databases, and network programming.
  62. 62What is a lock? What conditions must be met for it to function correctly?A lock is a synchronization mechanism used to protect shared resources from concurrent access by multiple threads. A lock ensures that only one thread can access the shared resource at a time. To function correctly, a lock must be acquired before accessing the shared resource and released after the access is complete. Failure to release a lock can lead to deadlocks or other synchronization issues.
  63. 63What is a thread pool?A thread pool is a collection of pre-allocated threads that can be used to execute multiple tasks concurrently. Thread pools are used to improve performance and reduce the overhead of thread creation and destruction in applications that require frequent thread usage.
  64. 64What is deadlock? What is livelock? How can deadlock be managed? How can deadlock be recovered from?Deadlock is a situation where two or more threads are blocked indefinitely, waiting for each other to release resources. Livelock is a situation where two or more threads are actively trying to acquire a resource but are continually blocked by each other. Deadlock can be managed by using techniques such as resource ordering, timeouts, and detection algorithms. Deadlock can be recovered from by aborting one or more threads involved in the deadlock or by releasing the resources being held.
  65. 65—

Informationen

Beschreibung
MSCS Principles of Operating Systems - Spring 2023 Karteikarten am UNR CS 646 Spring - Operating Systems Flashcards for midterm , erstellt von Ty Jones am 12/03/2023.
Erstellt von
Ty Jones
Aufrufe
1
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck