본문 바로가기

강의14

8. Linkers and Dynamic Linking When a process is running, what does its memory look like? A collection of regions called sections (or segments). Basic memory layout for Linux and other Unix systems: Code (or "text" in Unix terminology): starts at location 0 Data: starts immediately above code, grows upward Stack: starts at highest address, grows downward System components that take part in managing a process's memory: Compile.. 2022. 11. 14.
7. Deadlock The deadlock problem: Systems usually have multiple locks Threads often need to hold multiple locks at the same time. Deadlock definition: A collection of threads are all blocked. Each thread is waiting for a resource owned by one of the other threads. Since all therads are blocked, none can release their resources. Simple examples: Thread A Thread B lock_acquire(l1); lock_acquire(l2); lock_acqu.. 2022. 11. 13.
6. Implementing Locks How to implement locks and condition variables (inside the operating system)? Uniprocessor solution: just disable interrupts struct lock { int locked; struct queue q; }; void lock_acquire(struct lock *l) { intr_disable(); if (!l->locked) { l->locked = 1; } else { queue_add(&l->q, thread_current()); thread_block(); } intr_enable(); } void lock_release(struct lock *l) { intr_disable(); if (queue_e.. 2022. 11. 13.
5. Scheduling Resources fall into two classes: preemptible: can take resource away, use it for something else, then give it back later. Example: processor or I/O chanel. Non-preemptible: once given, it can't be reused until thread gives it back. Example: file space. OS makes two related kinds of decisions about resources: Allocation: who gets what. Given a set of requests for resources, which processes shoulc.. 2022. 11. 13.