Week 7 - Concurrency Flashcards
What does the view of an OS imply?
It implies that
What are the differences between historic computer and computer this year?
Historical, computer were seen expensive, due to maximise utilisation
Now: Users expect concurrent execution of multiple tasks
Stream musics, edit file, update software etc.
What challenges arise when processes do not work independently in a system?
Competition for resources - processes may compete for access to shared resources like devices, files, or data, whether local or remote.
Cooperation: Processes can cooperate using mechanisms such as messages, shared memory or files
Why do distributed applications face unique challenges?
- They support millions of users simultaneously, who may be reading or updating information.
- Examples,e include special networking sites (SNS), bank accounts, and online shopping platforms
Why is it important to interleave multiple independent task in applications?
- Avoid freezing - Apps with GUIs should remain responsive during time-consuming tasks.
- Improve user experience - For system like banking databases,users should not wait in long queues for transactions.
What are the key considerations for programmers and resources efficiency when building applications?
- Programmer Efficiency: Developers should not need to create an OS for every app they build
- Resource Efficiency: Applications should maximise the use of computing resources to ensure optimal performance.
How can we managed concurrency and ensure correctness?
- Concurrency Management:
Ensure multiple tasks can progress simultaneously.
Avoid conflicts when accessing shared resources. - Correctness:
Prevent issues like race conditions, deadlocks, and starvation.
Maintain program logic and data integrity. - Key Questions:
How can we do this conveniently?
How can we do this efficiently?
How can we maintain responsiveness?
How can we provide programming mechanisms to allow concurrency?
- Threads: Lightweight processes enabling parallel execution within a program
- Programming Mechanisms:
- Thread management libraries (e.g Java’s, Thread class
- Synchronisation tools (e.g. mutexes, semaphores)
- High-level abstraction (e.g thread pools,asynchrony/await) - Goals: Efficient task execution and it is to improve responsiveness and resource utilisation
What is the primary concern of OS design regarding processes?
OS design focuses on:
- Management of Processes: Efficiently handling multiple processes to maximise CPU utilisation.
- Management of Threads: Enabling lightweight, concurrent execution within a process
What is the 3 main types of processing in OS design?
- Multi-programming (multitasking)
- Multiprocessing
- Distributed Processing
Explain the function(s) of the 3 main types of processing OS design
- Multiprogramming: Execute multiple tasks by sharing CPU time. Also, ensure efficient resources use and the system responsiveness
- Multiprocessing:
- Involves multiple processors working in parallel
- Enhances performance and fault torelance - Distributed processing:
- Distribute tasks across different systems
- Enables scalability, fault tolerance, and resource sharing
What are the 3 different contexts in concurrency?
- Multiple applications: this was invented to allow processing time to be shared among active applications
- Structured applications: extension of modular design and structured programming
- Operating system structure: OS themselves implemented as a set of processes or threads.
Define some of the concurrency key terms
What are the 2 main principles of concurrency?
- Interleaving and Overlapping
- Uni processor -
What were the difficulties of concurrency?
- Sharing of global resources
- Difficult for the OS to manage the allocation of resources optimally
- Coordination of ‘ parallel’ and asynchronous ‘ processes’
- Ensuring correct behaviour
- Debugging of programming errors: behaviour can be non-deterministic, making it hard to identify and reproduce
What design and management issues does concurrency raise for an operating system?
The OS concerns are such as:
- Tracking processes: Keep track of all active and suspended processes
- Resoruces allocation and de allocation: Manage resources such as CPU, I/O etc efficiently for each process.
- Data and resource protection: Ensure processes cannot interfere with each other’s data or resources
- Output independence: Ensure the process outcomes remain consistent, regardless of execution speed or order.
What are responsibilities of the OS in managing concurrent processes?
The OS must:
- Process Management: Maintain control over process states and transitions
- Resource Management: Allocate CPU,memory, I/O efficiently
- Protection mechanisms: Adding isolation to prevent data corruption and resource misuse
- Consistency and independence: Ensure that process execution remains independent of variations in speed or scheduling
Process interaction
What causes conflict among concurrent processes, and what are some examples of resources they compete for?
There’s conflict when multiple processes compete for the same resource.
E.g: I/O devices: Printer, disk devices
Memory: Shaed or limited memory
Processor time: CPU cycles for excution
Clock: Timers and counters