15-213: Final Exam Review
|
|
- Anastasia Pearson
- 5 years ago
- Views:
Transcription
1 5-23: Final Exam Review Nikhil, Kashish, Krishanu, Stan
2 Threads and Synchronization Carnegie Mellon
3 Threads and Synchronization Carnegie Mellon Problem Statement: 5-23 Ts now want to begin a new procedure for daily office hours: When a student enters the room, he/she will see a table inside the room with several pens and several notebooks on it (if the pens and notebooks haven't been claimed by other students). Ts are inside the room waiting to help them.
4 Threads and Synchronization Carnegie Mellon Procedure for students: Wait until you get called, claim a pen and a notebook. Use the pen to write your questions on the notebook. fter you are done writing the question, release the pen. Hold the notebook and wait until a T is free to help you. fter you are done with talking to a T about the question, go back to claim a pen and write the solutions on the notebook. Release the pen and the notebook and go home.
5 Threads and Synchronization Typical Code to launch threads and wait for them to finish: sem_t pen; sem_t notebook; sem_t ta; int main(int argc, char** argv) { int P = 5, N = 5, T = 3, S = 5; sem_init(&pen,, P); sem_init(¬ebook,, N); sem_init(&ta,, T); int* students = malloc(s * sizeof(int)); launch_threads(); reap_threads(); } void launch_threads() { for(int i = ; i < S; i++) { students[s] = pthread_create(students+i, NULL, student_fn, NULL); } } void reap_threads() { for(int i = ; i < S; i++) { pthread_join(students[i]); } }
6 Threads and Synchronization student writes the following program to simulate the given procedures void* student_fn(void* varp) { P(&pen); P(¬ebook); sleep(genrand() % 6); // Time for you to write questions V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); sleep(genrand() % 6); // Time for you to write solutions Let us consider a simple example: Pens: 5 Notebooks: 5 Ts: Students: 5 V(¬ebook); V(&pen); } return ;
7 Threads and Synchronization student writes the following worker thread to simulate the given procedure void* student_fn(void* varp) { P(&pen); P(¬ebook); sleep(genrand() % 6); // Time for you to write questions V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); sleep(genrand() % 6); // Time for you to write solutions V(¬ebook); V(&pen); However, the code sometimes gets stuck by a deadlock. Which of the following is correct? : The deadlock is caused by the pen and the notebook. B: The deadlock is caused by the notebook and the T. C: The deadlock is caused by the T and the pen. } return ;
8 Threads and Synchronization Let s analyse the semaphores S: Signal W: Wait W:Get a pen void* student_fn(void* varp) { S: Give up pen W:Get a T S:Give up T W:Get a pen P(&pen); P(¬ebook); sleep(genrand() % 6); // Time for you to write questions V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); W:Get a Notebook sleep(genrand() % 6); // Time for you to write solutions Case C: Ts and Pens There is no overlap There can t be a case where a student who is talking to a T is waiting on a pen. There can t be a case where a student who is holding a pen is waiting on a T S: Give up pen V(¬ebook); V(&pen); S:Give up Notebook } return ;
9 Threads and Synchronization Let s analyse the semaphores S: Signal W: Wait W:Get a pen void* student_fn(void* varp) { P(&pen); P(¬ebook); W:Get a Notebook sleep(genrand() % 6); // Time for you to write questions Case B: Ts and Notebooks There is an overlap student who is holding a notebook may be waiting on a T S: Give up pen W:Get a T S:Give up T W:Get a pen V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); sleep(genrand() % 6); // Time for you to write solutions But. student who is talking to a T will not be waiting on a notebook S: Give up pen V(¬ebook); V(&pen); S:Give up Notebook } return ;
10 Threads and Synchronization Let s analyse the semaphores S: Signal W: Wait W:Get a pen void* student_fn(void* varp) { P(&pen); P(¬ebook); W:Get a Notebook sleep(genrand() % 6); // Time for you to write questions Case : Pens and Notebooks There is an overlap student who is holding a notebook may be waiting on a pen S: Give up pen W:Get a T S:Give up T W:Get a pen V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); sleep(genrand() % 6); // Time for you to write solutions student who is holding a pen may be waiting on a notebook S: Give up pen V(¬ebook); V(&pen); S:Give up Notebook } return ;
11 Threads and Synchronization Let s analyse the semaphores S: Signal W: Wait W:Get a pen void* student_fn(void* varp) { S: Give up pen W:Get a T S:Give up T W:Get a pen S: Give up pen } P(&pen); P(¬ebook); sleep(genrand() % 6); // Time for you to write questions V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); sleep(genrand() % 6); // Time for you to write solutions V(¬ebook); V(&pen); return ; W:Get a Notebook S:Give up Notebook Carnegie Mellon Case : Pens and Notebooks Consider this likely scenario: 5 Students (group ) enter the room They grab all 5 pens and all 5 notebooks on the table. Every student behind them is waiting on a pen and a notebook. (Group B) ll 5 students in Group give up their pens, but not their notebooks. 5 students in Group B immediately grab the 5 pens. Group B are now waiting on notebooks. fter talking to the Ts, all students in Group are now waiting on pens, which students in Group B have. Group B is waiting on the notebooks which students in Group have. DEDLOCK!!
12 Threads and Synchronization student writes the following program to simulate the given procedures void* student_fn(void* varp) { P(&pen); P(¬ebook); sleep(genrand() % 6); // Time for you to write questions V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); sleep(genrand() % 6); // Time for you to write solutions V(¬ebook); V(&pen); However, the code sometimes gets stuck by a deadlock. Which of the following is correct? : The deadlock is caused by the pen and the notebook. B: The deadlock is caused by the notebook and the ta. C: The deadlock is caused by the ta and the pen. } return ; NSWER:
13 Threads and Synchronization Carnegie Mellon Can we fix this without changing the Office Hour procedure?
14 Threads and Synchronization Carnegie Mellon Can we fix this without changing the Office Hour procedure? YES!
15 Threads and Synchronization Let s analyse the semaphores W:Get a pen S: Give up pen W:Get a T S:Give up T W:Get a pen S: Give up pen void* student_fn(void* varp) { } P(¬ebook); P(&pen); sleep(genrand() % 6); // Time for you to write questions V(&pen); P(&ta); sleep(genrand() % 9); // Time for you to ask T V(&ta); P(&pen); sleep(genrand() % 6); // Time for you to write solutions V(&pen); V(¬ebook); return ; //Go home S: Signal W: Wait W:Get a Notebook S:Give up Notebook Let s just re-order the locks and analyse it again. student who is holding a notebook may wait on a pen or a T However... student who is holding a pen will already have a notebook (and never wait on it). student who is talking to a T will already have a notebook (and never wait on it).
16 Virtual Memory Carnegie Mellon
17 Virtual Memory Virtual ddress - 8 Bits Physical ddress - 2 Bits Page Size - 52 Bytes TLB is 8-way set associative Cache is 2-way set associative Final S-2 (#5) Lecture 8: VM - Systems
18 Virtual Memory Carnegie Mellon Label the following: () VPO: Virtual Page Offset (B) VPN: Virtual Page Number (C) TLBI: TLB Index (D) TLBT: TLB Tag
19 Virtual Memory Carnegie Mellon Label the following: () VPO: Virtual Page Offset - Location in the page Page Size = 52 Bytes = 2 9 Need 9 bits
20 Virtual Memory Carnegie Mellon Label the following: () VPO: Virtual Page Offset (B) VPN: Virtual Page Number - Everything Else
21 Virtual Memory Carnegie Mellon Label the following: () VPO: Virtual Page Offset (B) VPN: Virtual Page Number (C) TLBI: TLB Index - Location in the TLB Cache
22 Virtual Memory Carnegie Mellon Label the following: () VPO: Virtual Page Offset (B) VPN: Virtual Page Number (C) TLBI: TLB Index - Location in the TLB Cache 2 Indices Bit TLBI
23 Virtual Memory Carnegie Mellon Label the following: () VPO: Virtual Page Offset (B) VPN: Virtual Page Number (C) TLBI: TLB Index (D) TLBT: TLB Tag - Everything Else TLBT TLBI
24 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset (B) PPN: Physical Page Number (C) CO: Cache Offset (D) CI: Cache Index (E) CT: Cache Tag
25 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset
26 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset - Same as VPO
27 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset - Same as VPO (B) PPN: Physical Page Number - Everything Else B B B
28 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset - Same as VPO (B) PPN: Physical Page Number - Everything Else (C) CO: Cache Offset - Offset in Block B B B
29 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset - Same as VPO (B) PPN: Physical Page Number - Everything Else (C) CO: Cache Offset - Offset in Block 4 Byte Blocks 2 Bits B B B CO
30 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset - Same as VPO (B) PPN: Physical Page Number - Everything Else (C) CO: Cache Offset - Offset in Block (D) CI: Cache Index B B B CO
31 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset - Same as VPO (B) PPN: Physical Page Number - Everything Else (C) CO: Cache Offset - Offset in Block (D) CI: Cache Index 4 Indices 2 Bits B B B CI CO
32 Virtual Memory Carnegie Mellon Label the following: () PPO: Physical Page Offset - Same as VPO (B) PPN: Physical Page Number - Everything Else (C) CO: Cache Offset - Offset in Block (D) CI: Cache Index (E) CT: Cache Tag - Everything Else B B B Cache Tag CI CO
33 Virtual Memory Carnegie Mellon Now to the actual question! Q) Translate the following address: x9f4
34 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation = = 9 = F = 4 =
35 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information: VPN: x?? TLBI: x?? TLBT: x?? TLB Hit: Y/N? Page Fault: Y/N? PPN: x??
36 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information: VPN: xd4 TLBI: x?? TLBT: x?? TLB Hit: Y/N? Page Fault: Y/N? PPN: x??
37 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information: VPN: xd4 TLBI: x TLBT: x?? TLB Hit: Y/N? Page Fault: Y/N? PPN: x??
38 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information: VPN: xd4 TLBI: x TLBT: x6 TLB Hit: Y/N? Page Fault: Y/N? PPN: x??
39 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information: VPN: xd4 TLBI: x TLBT: x6 TLB Hit: Y! Page Fault: Y/N? PPN: x??
40 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information: VPN: xd4 TLBI: x TLBT: x6 TLB Hit: Y! Page Fault: N! PPN: x??
41 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information: VPN: xd4 TLBI: x TLBT: x6 TLB Hit: Y! Page Fault: N! PPN: x3
42 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information 3. Put it all together: PPN: x3, PPO = x??
43 Virtual Memory Now to the actual question! Q) Translate the following address: x9f4. Write down bit representation 2. Extract Information 3. Put it all together: PPN: x3, PPO = VPO = xf4
44 Virtual Memory Carnegie Mellon Q) What is the value of the address? CO: x?? CI: x?? CT: x?? Cache Hit: Y/N? Value:x??
45 Virtual Memory Q) What is the value of the address?. Extract more information CO: x CI: x?? CT: x?? Cache Hit: Y/N? Value:x??
46 Virtual Memory Q) What is the value of the address?. Extract more information CO: x CI: x CT: x?? Cache Hit: Y/N? Value:x??
47 Virtual Memory Q) What is the value of the address?. Extract more information 2. Go to Cache Table CO: x CI: x CT: x7f Cache Hit: Y/N? Value:x??
48 Virtual Memory Q) What is the value of the address?. Extract more information 2. Go to Cache Table CO: x CI: x CT: x7f Cache Hit: Y Value:x??
49 Virtual Memory Q) What is the value of the address?. Extract more information 2. Go to Cache Table CO: x CI: x CT: x7f Cache Hit: Y Value:xFF
50 Virtual Memory Carnegie Mellon
51 IO/Processes Carnegie Mellon
52 IO/Processes foo.txt: abcdefgh...xyz int main() { int fd, fd2, fd3; char c; pid_t pid; fd = open( foo.txt, O_RDONLY); fd2 = open( foo.txt, O_RDONLY); fd3 = open( foo.txt, O_RDONLY); read(fd, &c, sizeof(c)); // c =? read(fd2, &c, sizeof(c)); // c =? dup2(fd2, fd3); read(fd3, &c, sizeof(c)); // c =? read(fd2, &c, sizeof(c)); // c =? Main ideas: How does read offset? How does dup2 work? What is the order of arguments? Does fd3 share offset with fd2?
53 IO/Processes foo.txt: abcdefgh...xyz int main() { int fd, fd2, fd3; char c; pid_t pid; fd = open( foo.txt, O_RDONLY); fd2 = open( foo.txt, O_RDONLY); fd3 = open( foo.txt, O_RDONLY); read(fd, &c, sizeof(c)); read(fd2, &c, sizeof(c)); dup2(fd2, fd3); read(fd3, &c, sizeof(c)); read(fd2, &c, sizeof(c)); // c = a // c = a // c = b // c = c How does read offset? Incremented by number of bytes read How does dup2 work? ny read/write from fd3 now happen from fd2 ll file offsets are shared
54 IO/Processes read(fd, &c, sizeof(c)); // a read(fd2, &c, sizeof(c)); // a dup2(fd2, fd3); read(fd3, &c, sizeof(c)); // b read(fd2, &c, sizeof(c)); // c pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); printf( c = %c\n, c); dup2(fd, fd2); read(fd3, &c, sizeof(c)); printf( c = %c\n, c); } read(fd2, &c, sizeof(c)); printf( c = %c\n, c); read(fd, &c, sizeof(c)); printf( c = %c\n, c); Main ideas: How are fd shared between processes? How does dup2 work from parent to child? How are file offsets shared between processes?
55 IO/Processes Carnegie Mellon read(fd, &c, sizeof(c)); // a read(fd2, &c, sizeof(c)); // a dup2(fd2, fd3); read(fd3, &c, sizeof(c)); // b read(fd2, &c, sizeof(c)); // c pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); printf( c = %c\n, c); dup2(fd, fd2); read(fd3, &c, sizeof(c)); printf( c = %c\n, c); } read(fd2, &c, sizeof(c)); printf( c = %c\n, c); read(fd, &c, sizeof(c)); printf( c = %c\n, c); What would this program print?
56 IO/Processes read(fd, &c, sizeof(c)); // a read(fd2, &c, sizeof(c)); // a dup2(fd2, fd3); read(fd3, &c, sizeof(c)); // b read(fd2, &c, sizeof(c)); // c pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); printf( c = %c\n, c); dup2(fd, fd2); read(fd3, &c, sizeof(c)); printf( c = %c\n, c); } read(fd2, &c, sizeof(c)); printf( c = %c\n, c); read(fd, &c, sizeof(c)); printf( c = %c\n, c); Possible output : c = d // in parent from fd2 c = b // in parent from fd c = c // in child from fd c = e // in child from fd3 c = d // in child from fd2 c = e // in child from fd
57 IO/Processes read(fd, &c, sizeof(c)); // a read(fd2, &c, sizeof(c)); // a dup2(fd2, fd3); read(fd3, &c, sizeof(c)); // b read(fd2, &c, sizeof(c)); // c pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); printf( c = %c\n, c); dup2(fd, fd2); read(fd3, &c, sizeof(c)); printf( c = %c\n, c); } read(fd2, &c, sizeof(c)); printf( c = %c\n, c); read(fd, &c, sizeof(c)); printf( c = %c\n, c); Possible output 2: c = b // in child from fd c = d // in child from fd3 c = c // in child from child s fd2 c = d // in child from fd c = e // in parent from parent s fd2 c = e // in parent from fd
58 IO/Processes Carnegie Mellon read(fd, &c, sizeof(c)); // a read(fd2, &c, sizeof(c)); // a dup2(fd2, fd3); read(fd3, &c, sizeof(c)); // b read(fd2, &c, sizeof(c)); // c pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); printf( c = %c\n, c); dup2(fd, fd2); read(fd3, &c, sizeof(c)); printf( c = %c\n, c); } read(fd2, &c, sizeof(c)); printf( c = %c\n, c); read(fd, &c, sizeof(c)); printf( c = %c\n, c); Other interleavings of child/parent are possible
59 IO/Processes Carnegie Mellon }.. pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); printf( c = %c\n, c); dup2(fd, fd2); read(fd3, &c, sizeof(c)); printf( c = %c\n, c); } if (pid!=) waitpid(-, NULL, ); read(fd2, &c, sizeof(c)); printf( c = %c\n, c); read(fd, &c, sizeof(c)); printf( c = %c\n, c); return ; What are the possible outputs now?
60 IO/Processes }.. pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); printf( c = %c\n, c); dup2(fd, fd2); read(fd3, &c, sizeof(c)); printf( c = %c\n, c); } if (pid!=) waitpid(-, NULL, ); read(fd, &c, sizeof(c)); printf( c = %c\n, c); read(fd2, &c, sizeof(c)); printf( c = %c\n, c); return ; Possible output 2: c = b // in child from fd c = d // in child from fd3 c = c // in child from child s fd2 c = d // in child from fd c = e // in parent from parent s fd2 c = e // in parent from fd
61 IO/Processes read(fd, &c, sizeof(c)); // a read(fd2, &c, sizeof(c)); // a dup2(fd2, fd3); read(fd3, &c, sizeof(c)); // b read(fd2, &c, sizeof(c)); // c pid = fork(); if (pid==) { read(fd, &c, sizeof(c)); dup2(fd, fd2); read(fd3, &c, sizeof(c)); } if (pid!=) waitpid(-, NULL, ); read(fd2, &c, sizeof(c)); read(fd, &c, sizeof(c)); Child creates a copy of the parent fd table dup2/open/close in parent affect the child dup2/open/close in child do NOT affect the parent File descriptors across processes share the same file offset Carnegie Mellon
62 Malloc Carnegie Mellon
63 Malloc Carnegie Mellon Fit algorithms - first/next/best/good Fragmentation Internal - inside blocks External - between blocks Organization Implicit Explicit Segregated
64 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) b = malloc(6) c = malloc(6) d = malloc(4) free(c) free(a) e = malloc(6) free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
65 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) b = malloc(6) c = malloc(6) d = malloc(4) free(c) free(a) e = malloc(6) free(d) f = malloc(48) free(b) 48a final-f.pdf: Problem Part
66 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) d = malloc(4) free(c) free(a) e = malloc(6) free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
67 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) free(c) free(a) e = malloc(6) free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
68 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) free(a) e = malloc(6) free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
69 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) e = malloc(6) free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
70 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a e = malloc(6) free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
71 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48a 32a 32f [] 48a free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
72 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48a 32a 32f [] 48a f = malloc(48) free(d) 48a 32a 8f [] free(b) final-f.pdf: Problem Part
73 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48a 32a 32f [] 48a free(d) 48a 32a 8f [] f = malloc(48) 48a 32a 8a free(b) final-f.pdf: Problem Part
74 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48a 32a 32f [] 48a free(d) 48a 32a 8f [] f = malloc(48) 48a 32a 8a free(b) 48a 32f [] 8a final-f.pdf: Problem Part
75 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size fragmentation? internal? a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48a 32a 32f [] 48a free(d) 48a 32a 8f [] f = malloc(48) 48a 32a 8a free(b) 48a 32f [] 8a
76 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size fragmentation? internal (48-6) + (8-48) = 64 external? a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48a 32a 32f [] 48a free(d) 48a 32a 8f [] f = malloc(48) 48a 32a 8a free(b) 48a 32f [] 8a
77 Malloc - First fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size fragmentation? internal (48-6) + (8-48) = 64 external 32 a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48a 32a 32f [] 48a free(d) 48a 32a 8f [] f = malloc(48) 48a 32a 8a free(b) 48a 32f [] 8a
78 Malloc - Best fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) b = malloc(6) c = malloc(6) d = malloc(4) free(c) free(a) e = malloc(6) free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
79 Malloc - Best fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a e = malloc(6) free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
80 Malloc - Best fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48f [] 32a 32a 48a free(d) f = malloc(48) free(b) final-f.pdf: Problem Part
81 Malloc - Best fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48f [] 32a 32a 48a f = malloc(48) free(d) 48f [] 32a 32a 48f [] free(b) final-f.pdf: Problem Part
82 Malloc - Best fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48f [] 32a 32a 48a free(d) 48f [] 32a 32a 48f [] f = malloc(48) 48f [] 32a 32a 64a free(b) final-f.pdf: Problem Part
83 Malloc - Best fit # #2 #3 #4 #5 #6 6 byte align coalesced footerless 32 min size a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48f [] 32a 32a 48a free(d) 48f [] 32a 32a 48f [] f = malloc(48) 48f [] 32a 32a 64a free(b) 8f [] 32a 64a final-f.pdf: Problem Part
84 Malloc - Best fit 6 byte align coalesced footerless 32 min size fragmentation? internal? Carnegie Mellon # #2 #3 #4 #5 #6 a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48f [] 32a 32a 48a free(d) 48f [] 32a 32a 48f [] f = malloc(48) 48f [] 32a 32a 64a free(b) 8f [] 32a 64a
85 Malloc - Best fit 6 byte align coalesced footerless 32 min size fragmentation? internal (32-6) + (64-48) = 32 external? Carnegie Mellon # #2 #3 #4 #5 #6 a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48f [] 32a 32a 48a free(d) 48f [] 32a 32a 48f [] f = malloc(48) 48f [] 32a 32a 64a free(b) 8f [] 32a 64a
86 Malloc - Best fit 6 byte align coalesced footerless 32 min size fragmentation? internal (32-6) + (64-48) = 32 external 8 Carnegie Mellon # #2 #3 #4 #5 #6 a = malloc(32) 48a b = malloc(6) 48a 32a c = malloc(6) 48a 32a 32a d = malloc(4) 48a 32a 32a 48a free(c) 48a 32a 32f [] 48a free(a) 48f [] 32a 32f [] 48a e = malloc(6) 48f [] 32a 32a 48a free(d) 48f [] 32a 32a 48f [] f = malloc(48) 48f [] 32a 32a 64a free(b) 8f [] 32a 64a
87 Signals Carnegie Mellon who would win? several hundred lines of tshlab code one asynchronous boi
88 Signals Carnegie Mellon Examples in these slides are important gotchas NOT an inclusive list In particular, these do NOT go over signals sent between multiple processes Many more examples in: Recitation slides Lecture slides Past exams Reminder: solve the questions on your own when studying before looking at the answer
89 Signals Does the following code ever terminate? void handler(int sig) { while(); } int main() { Signal(SIGUSR, handler); Kill(, SIGUSR); return ; }
90 Signals Does the following code ever terminate? void handler(int sig) { while(); // stuck here forever! } int main() { Signal(SIGUSR, handler); // Spec says signal sent to self must be handled // before kill() returns Kill(, SIGUSR); return ; }
91 Signals What about now? void handler(int sig) { Kill(, SIGUSR); } int main() { Signal(SIGUSR, handler); Kill(, SIGUSR); return ; }
92 Signals What about now? void handler(int sig) { Kill(, SIGUSR); } int main() { Signal(SIGUSR, handler); Kill(, SIGUSR); return ; } Does not terminate: main: Kill(, SIGUSR); <SIGUSR handler invoked, SIGUSR blocked in handler> handler: Kill(, SIGUSR); <SIGUSR pending> <handler returns> <SIGUSR unblocked, SIGUSR handler invoked, SIGUSR blocked in handler> handler: Kill(, SIGUSR);...repeat...
93 Good luck! Carnegie Mellon
Systems programming and Operating systems, 2005 Tentamen
Namn: Person-nummer: Instructions: Systems programming and Operating systems, 2005 Tentamen 2005-12-14 Make sure that your exam is not missing any sheets, then write your name and person-nummer on the
More informationSystems programming and Operating systems, 2005 Test Exam
Namn: Person-nummer: Instructions: Systems programming and Operating systems, 2005 Test Exam Make sure that your exam is not missing any sheets, then write your name and person-nummer on the front. If
More informationRecitation 8: Tshlab + VM
Recitation 8: Tshlab + VM Instructor: TAs 1 Outline Labs Signals IO Virtual Memory 2 TshLab and MallocLab TshLab due Tuesday MallocLab is released immediately after Start early Do the checkpoint first,
More information15-213/18-243, Spring 2011 Exam 2
Andrew login ID: Full Name: Section: 15-213/18-243, Spring 2011 Exam 2 Thursday, April 21, 2011 v2 Instructions: Make sure that your exam is not missing any sheets, then write your Andrew login ID, full
More informationIntroduction to Computer Systems. Exam 2. April 11, Notes and calculators are permitted, but not computers.
15-213 Introduction to Computer Systems Exam 2 April 11, 2006 Name: Andrew User ID: Recitation Section: Model Solution fp This is an open-book exam. Notes and calculators are permitted, but not computers.
More informationCS , Spring 2002 Exam 2
Full Name: CS 15-213, Spring 2002 Exam 2 March 28, 2002 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write your answers
More informationProblem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses.
Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses. The memory is byte addressable. Memory accesses are to 1-byte
More informationCSCI 237 Sample Final Exam
Problem 1. (12 points): Multiple choice. Write the correct answer for each question in the following table: 1. What kind of process can be reaped? (a) Exited (b) Running (c) Stopped (d) Both (a) and (c)
More informationVirtual Memory: Systems
Virtual Memory: Systems 5-23: Introduction to Computer Systems 8 th Lecture, March 28, 27 Instructor: Franz Franchetti & Seth Copen Goldstein Recap: Hmmm, How Does This Work?! Process Process 2 Process
More information15-213/18-213, Fall 2011 Final Exam
Andrew ID (print clearly!): Full Name: 15-213/18-213, Fall 2011 Final Exam Friday, December 16, 2011 Instructions: Make sure that your exam is not missing any sheets, then write your Andrew ID and full
More informationCS , Fall 2001 Exam 2
Andrew login ID: Full Name: CS 15-213, Fall 2001 Exam 2 November 13, 2001 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write
More informationCS , Fall 2003 Exam 2
Andrew login ID: Full Name: CS 15-213, Fall 2003 Exam 2 November 18, 2003 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write
More informationRecitation 15: Final Exam Preparation
15-213 Recitation 15: Final Exam Preparation 25 April 2016 Ralf Brown and the 15-213 staff 1 Agenda Reminders Final Exam Review Fall 2012 exam 2 Reminders Proxy lab is due tomorrow! NO GRACE DAYS Penalty
More information15-213/18-213, Fall 2012 Final Exam
Andrew ID (print clearly!): Full Name: 15-213/18-213, Fall 2012 Final Exam Monday, December 10, 2012 Instructions: Make sure that your exam is not missing any sheets, then write your Andrew ID and full
More informationCS , Fall 2001 Exam 2
Andrew login ID: Full Name: CS 15-213, Fall 2001 Exam 2 November 13, 2001 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write
More informationFoundations of Computer Systems
8-6 Foundations of Computer Systems Lecture 5: Virtual Memory Concepts and Systems October 8, 27 8-6 SE PL OS CA Required Reading Assignment: Chapter 9 of CS:APP (3 rd edition) by Randy Bryant & Dave O
More informationCSE 153 Design of Operating Systems
CSE 53 Design of Operating Systems Winter 28 Lecture 6: Paging/Virtual Memory () Some slides modified from originals by Dave O hallaron Today Address spaces VM as a tool for caching VM as a tool for memory
More informationVirtual Memory Nov 9, 2009"
Virtual Memory Nov 9, 2009" Administrivia" 2! 3! Motivations for Virtual Memory" Motivation #1: DRAM a Cache for Disk" SRAM" DRAM" Disk" 4! Levels in Memory Hierarchy" cache! virtual memory! CPU" regs"
More informationCMSC 313 Spring 2010 Exam 3 May 17, 2010
CMSC 313 Spring 2010 Exam 3 May 17, 2010 Name Score UMBC Username Notes: a. Please write clearly. Unreadable answers receive no credit. b. There are no intentional syntax errors in any code provided with
More informationVirtual Memory: Systems
Virtual Memory: Systems 5-23 / 8-23: Introduc2on to Computer Systems 7 th Lecture, Mar. 22, 22 Instructors: Todd C. Mowry & Anthony Rowe Today Virtual memory ques7ons and answers Simple memory system example
More informationRecitation 8 Processes, Signals, Tshlab
15-213 Recitation 8 Processes, Signals, Tshlab 22 October 2018 1 Outline Cachelab Style Process Lifecycle Signal Handling 2 Cachelab Style Grading Style grades will be available "soon" Click on your score
More information15-213/18-213, Spring 2012 Final Exam
Andrew ID (print clearly!): Full Name: 15-213/18-213, Spring 2012 Final Exam Friday, May 11, 2012 Instructions: Make sure that your exam is not missing any sheets, then write your Andrew ID and full name
More informationUW CSE 351, Winter 2013 Final Exam
Full Name: Student ID #: UW CSE 351, Winter 2013 Final Exam March 20, 2013 2:30pm - 4:20pm Instructions: Write your full name and UW student ID number on the front of the exam. When the exam begins, make
More informationCROWDMARK. Examination Midterm. Spring 2017 CS 350. Closed Book. Page 1 of 30. University of Waterloo CS350 Midterm Examination.
Times: Thursday 2017-06-22 at 19:00 to 20:50 (7 to 8:50PM) Duration: 1 hour 50 minutes (110 minutes) Exam ID: 3520593 Please print in pen: Waterloo Student ID Number: WatIAM/Quest Login Userid: Sections:
More informationQuestion F5: Caching [10 pts]
Question F5: Caching [ pts] SID: We have 6 KiB of RAM and two options for our cache. Both are two-way set associative with 256 B blocks, LRU replacement, and write-back policies. Cache A is size KiB and
More informationFoundations of Computer Systems
18-600 Foundations of Computer Systems Lecture 16: Dynamic Memory Allocation October 23, 2017 18-600 SE PL OS CA Required Reading Assignment: Chapter 9 of CS:APP (3 rd edition) by Randy Bryant & Dave O
More informationFinal Exam Introduction to Computer Systems. May 10, Name: Andrew User ID: Recitation Section: Model Solution fp
15-213 Introduction to Computer Systems Final Exam May 10, 2007 Name: Andrew User ID: Recitation Section: Model Solution fp This is an open-book exam. Notes and calculators are permitted, but not computers.
More information198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14
98:23 Intro to Computer Organization Lecture 4 Virtual Memory 98:23 Introduction to Computer Organization Lecture 4 Instructor: Nicole Hynes nicole.hynes@rutgers.edu Credits: Several slides courtesy of
More informationThe cache is 4-way set associative, with 4-byte blocks, and 16 total lines
Sample Problem 1 Assume the following memory setup: Virtual addresses are 20 bits wide Physical addresses are 15 bits wide The page size if 1KB (2 10 bytes) The TLB is 2-way set associative, with 8 total
More informationCS Operating system Summer Midterm I -- July 11, 2017 You have 115 min (10:00am-11:55pm). Good Luck!
Name / ID (please PRINT) Seq#: Seat #: CS 3733.001 -- Operating system Summer 2017 -- Midterm I -- July 11, 2017 You have 115 min (10:00am-11:55pm). Good Luck! This is a closed book/note examination. But
More informationCS , Spring 2002 Final Exam
Andrew login ID: Full Name: CS 15-213, Spring 2002 Final Exam May 9, 2002 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write
More informationProcesses and Virtual Memory Concepts
Processes and Virtual Memory Concepts Brad Karp UCL Computer Science CS 37 8 th February 28 (lecture notes derived from material from Phil Gibbons, Dave O Hallaron, and Randy Bryant) Today Processes Virtual
More informationRecitation Processes, Signals,UNIX error handling
15-213 Recitation Processes, Signals,UNIX error handling Section X - TA name 18 March 2019 Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition 1 Outline Logistics Process
More informationVirtual Memory. Alan L. Cox Some slides adapted from CMU slides
Alan L. Cox alc@rice.edu Some slides adapted from CMU 5.23 slides Objectives Be able to explain the rationale for VM Be able to explain how VM is implemented Be able to translate virtual addresses to physical
More informationCSE351 Spring 2010 Final Exam (9 June 2010)
CSE351 Spring 2010 Final Exam (9 June 2010) Please read through the entire examination first! We designed this exam so that it can be completed in 100 minutes and, hopefully, this estimate will prove to
More informationCarnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition
Carnegie Mellon Virtual Memory: Concepts 5-23: Introduction to Computer Systems 7 th Lecture, October 24, 27 Instructor: Randy Bryant 2 Hmmm, How Does This Work?! Process Process 2 Process n Solution:
More informationP6/Linux Memory System Nov 11, 2009"
P6/Linux Memory System Nov 11, 2009" REMEMBER" 2! 3! Intel P6" P6 Memory System" DRAM" external system bus (e.g. PCI)" L2" cache" cache bus! bus interface unit" inst" TLB" instruction" fetch unit" L1"
More informationCSE351 Spring 2010 Final Exam (9 June 2010)
CSE351 Spring 2010 Final Exam (9 June 2010) Please read through the entire examination first! We designed this exam so that it can be completed in 100 minutes and, hopefully, this estimate will prove to
More informationCarnegie Mellon. 16 th Lecture, Mar. 20, Instructors: Todd C. Mowry & Anthony Rowe
Virtual Memory: Concepts 5 23 / 8 23: Introduction to Computer Systems 6 th Lecture, Mar. 2, 22 Instructors: Todd C. Mowry & Anthony Rowe Today Address spaces VM as a tool lfor caching VM as a tool for
More informationMemory System Case Studies Oct. 13, 2008
Topics 15-213 Memory System Case Studies Oct. 13, 2008 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping Class15+.ppt Intel P6 (Bob Colwell s Chip,
More informationIC221: Systems Programming 12-Week Written Exam [SOLUTIONS]
IC221: Systems Programming 12-Week Written Exam [SOLUTIONS] April 2, 2014 Answer the questions in the spaces provided on the question sheets. If you run out of room for an answer, continue on the back
More informationVirtual Memory II. CSE 351 Autumn Instructor: Justin Hsia
Virtual Memory II CSE 35 Autumn 27 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan https://xkcd.com/495/
More informationIntroduction to Computer Systems. Exam 2. April 10, Notes and calculators are permitted, but not computers.
15-213 Introduction to Computer Systems Exam 2 April 10, 2007 Name: Andrew User ID: Recitation Section: This is an open-book exam. Notes and calculators are permitted, but not computers. Write your answer
More informationCSE351 Autumn 2010 Final Exam (December 13, 2010)
CSE351 Autumn 2010 Final Exam (December 13, 2010) Please read through the entire examination first! We designed this exam so that it can be completed in 100 minutes and, hopefully, this estimate will prove
More information14 May 2012 Virtual Memory. Definition: A process is an instance of a running program
Virtual Memory (VM) Overview and motivation VM as tool for caching VM as tool for memory management VM as tool for memory protection Address translation 4 May 22 Virtual Memory Processes Definition: A
More informationPentium/Linux Memory System March 17, 2005
15-213 The course that gives CMU its Zip! Topics Pentium/Linux Memory System March 17, 2005 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping 17-linuxmem.ppt
More informationVirtual Memory II. CSE 351 Autumn Instructor: Justin Hsia
Virtual Memory II CSE 35 Autumn 26 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun https://xkcd.com/495/
More informationA Few Problems with Physical Addressing. Virtual Memory Process Abstraction, Part 2: Private Address Space
Process Abstraction, Part : Private Motivation: why not direct physical memory access? Address translation with pages Optimizing translation: translation lookaside buffer Extra benefits: sharing and protection
More informationPart I: Pen & Paper Exercises, Cache
Fall Term 2016 SYSTEMS PROGRAMMING AND COMPUTER ARCHITECTURE Assignment 11: Caches & Virtual Memory Assigned on: 8th Dec 2016 Due by: 15th Dec 2016 Part I: Pen & Paper Exercises, Cache Question 1 The following
More informationFirst Midterm Exam September 28, 2017 CS162 Operating Systems
University of California, Berkeley College of Engineering Computer Science Division EECS Fall 2017 Ion Stoica First Midterm Exam September 28, 2017 CS162 Operating Systems Your Name: SID AND 162 Login
More informationProcess Management 1
Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Programmatically redirecting stdin, stdout, and stderr (Appendix) communication between processes via pipes Why?
More informationProblem Page Possible Score Total 80
Full Name: CSCI 540, Fall 2014 Practice Final Exam Instructions: Make sure that your exam is not missing any sheets, then write your full name on the front. Put your name or student ID on each page. Write
More informationThis lecture. Virtual Memory. Virtual memory (VM) CS Instructor: Sanjeev Se(a
Virtual Memory Instructor: Sanjeev Se(a This lecture (VM) Overview and mo(va(on VM as tool for caching VM as tool for memory management VM as tool for memory protec(on Address transla(on 2 Virtual Memory
More informationVirtual Memory Oct. 29, 2002
5-23 The course that gives CMU its Zip! Virtual Memory Oct. 29, 22 Topics Motivations for VM Address translation Accelerating translation with TLBs class9.ppt Motivations for Virtual Memory Use Physical
More informationCS240: Programming in C
CS240: Programming in C Lecture 17: Processes, Pipes, and Signals Cristina Nita-Rotaru Lecture 17/ Fall 2013 1 Processes in UNIX UNIX identifies processes via a unique Process ID Each process also knows
More informationRoadmap. Java: Assembly language: OS: Machine code: Computer system:
Roadmap C: car *c = malloc(sizeof(car)); c->miles = ; c->gals = 7; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp Java: Car c = new
More informationCS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017
CS 471 Operating Systems Yue Cheng George Mason University Fall 2017 1 Review: Sync Terminology Worksheet 2 Review: Semaphores 3 Semaphores o Motivation: Avoid busy waiting by blocking a process execution
More informationVirtual Memory. Samira Khan Apr 27, 2017
Virtual Memory Samira Khan Apr 27, 27 Virtual Memory Idea: Give the programmer the illusion of a large address space while having a small physical memory So that the programmer does not worry about managing
More informationVirtual Memory: Concepts
Virtual Memory: Concepts 5-23: Introduction to Computer Systems 7 th Lecture, March 2, 27 Instructors: Franz Franchetti & Seth Copen Goldstein Hmmm, How Does This Work?! Process Process 2 Process n Solution:
More informationSystem Programming. Pipes I
Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Review Signals and files
More informationComputer Systems. Virtual Memory. Han, Hwansoo
Computer Systems Virtual Memory Han, Hwansoo A System Using Physical Addressing CPU Physical address (PA) 4 Main memory : : 2: 3: 4: 5: 6: 7: 8:... M-: Data word Used in simple systems like embedded microcontrollers
More informationCSE 351. Virtual Memory
CSE 351 Virtual Memory Virtual Memory Very powerful layer of indirection on top of physical memory addressing We never actually use physical addresses when writing programs Every address, pointer, etc
More informationChapter 5: Memory Management
ADRIAN PERRIG & TORSTEN HOEFLER ( 252-0062-00 ) Networks and Operating Systems Chapter 5: Memory Management http://support.apple.com/kb/ht562 Description: The ios kernel has checks to validate that the
More informationReading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1
Reading Assignment 4 Chapter 4 Threads, due 2/7 1/31/13 CSE325 - Processes 1 What s Next? 1. Process Concept 2. Process Manager Responsibilities 3. Operations on Processes 4. Process Scheduling 5. Cooperating
More informationOperating System Structure
Operating System Structure CSCI 4061 Introduction to Operating Systems Applications Instructor: Abhishek Chandra Operating System Hardware 2 Questions Operating System Structure How does the OS manage
More informationRecitation 14: Proxy Lab Part 2
Recitation 14: Proxy Lab Part 2 Instructor: TA(s) 1 Outline Proxylab Threading Threads and Synchronization PXYDRIVE Demo 2 ProxyLab Checkpoint is worth 1%, due Thursday, Nov. 29 th Final is worth 7%, due
More informationLogistics. Recitation 11: I/O Problems. Today s Plan. Why Use Robust I/O. Andrew Faulring Section A 18 November 2002
Logistics faulring@cs.cmu.edu Recitation 11: I/O Problems Andrew Faulring 15213 Section A 18 November 2002 Office hours NSH 2504 Permanently moving to Tuesday 2 3 What s left Lab 6 Malloc: due on Thursday,
More informationCS 322 Operating Systems Practice Midterm Questions
! CS 322 Operating Systems 1. Processes go through the following states in their lifetime. time slice ends Consider the following events and answer the questions that follow. Assume there are 5 processes,
More informationWindows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.
Structure Unix architecture users Functions of the System tools (shell, editors, compilers, ) standard library System call Standard library (printf, fork, ) OS kernel: processes, memory management, file
More informationQ1. State True/false with jusification if the answer is false:
Paper Title: Operating System (IOPS332C) Quiz 1 Time : 1 hr Q1. State True/false with jusification if the answer is false: a. Multiprogramming (having more programs in RAM simultaneously) decreases total
More informationCPS 310 first midterm exam, 10/6/2014
CPS 310 first midterm exam, 10/6/2014 Your name please: Part 1. More fun with fork and exec* What is the output generated by this program? Please assume that each executed print statement completes, e.g.,
More informationSection 7: Wait/Exit, Address Translation
William Liu October 15, 2014 Contents 1 Wait and Exit 2 1.1 Thinking about what you need to do.............................. 2 1.2 Code................................................ 2 2 Vocabulary 4
More informationGiving credit where credit is due
CSCE 230J Computer Organization Exceptional Control Flow Part I Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for this
More informationCS Operating system Spring Final -- May 8, You have 120 min. Good Luck!
Name / ID (please PRINT) Sequence #: Seat Number: CS 3733.001 -- Operating system Spring 2017 -- Final -- May 8, 2017 @9:45am You have 120 min. Good Luck! This is a closed book/note examination. But You
More informationContents. IPC (Inter-Process Communication) Representation of open files in kernel I/O redirection Anonymous Pipe Named Pipe (FIFO)
Pipes and FIFOs Prof. Jin-Soo Kim( jinsookim@skku.edu) TA JinHong Kim( jinhong.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Contents IPC (Inter-Process Communication)
More informationCSC209H Lecture 6. Dan Zingaro. February 11, 2015
CSC209H Lecture 6 Dan Zingaro February 11, 2015 Zombie Children (Kerrisk 26.2) As with every other process, a child process terminates with an exit status This exit status is often of interest to the parent
More informationCS , Spring 2009 Exam 2
Andrew login ID: Full Name: Recitation Section: CS 15-213, Spring 2009 Exam 2 Tues., April 7th, 2009 Instructions: Make sure that your exam is not missing any sheets, then write your full name, Andrew
More informationVirtual Memory. Motivations for VM Address translation Accelerating translation with TLBs
Virtual Memory Today Motivations for VM Address translation Accelerating translation with TLBs Fabián Chris E. Bustamante, Riesbeck, Fall Spring 2007 2007 A system with physical memory only Addresses generated
More informationVirtual Memory Overview
Virtual Memory Overview Virtual address (VA): What your program uses Virtual Page Number Page Offset Physical address (PA): What actually determines where in memory to go Physical Page Number Page Offset
More informationCSI Module 2: Processes
CSI3131 - Module 2: es Reading: Chapter 3 (Silberchatz) Objective: To understand the nature of processes including the following concepts: states, the PCB (process control block), and process switching.
More informationCS , Fall 2008 Final Exam
Andrew login ID: Full Name: Recitation Section: CS 15-213, Fall 2008 Final Exam Friday. December 12, 2008 Instructions: Make sure that your exam is not missing any sheets, then write your full name, Andrew
More informationSection 2: Processes
September 7, 2016 Contents 1 Warmup 2 1.1 Hello World............................................ 2 2 Vocabulary 2 3 Problems 3 3.1 Forks................................................ 3 3.2 Stack Allocation.........................................
More informationOS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed
Process Management CS 537 Lecture 3: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units
More informationEL2310 Scientific Programming
Lecture 11: Memory, Files and Bitoperations (yaseminb@kth.se) Overview Overview Lecture 11: Memory, Files and Bit operations Main function; reading and writing Bitwise Operations Lecture 11: Memory, Files
More informationCS 153 Design of Operating Systems
CS 53 Design of Operating Systems Spring 8 Lectre 9: Locality and Cache Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals
More informationCarnegie Mellon. Processes. Lecture 12, May 19 th Alexandre David. Credits to Randy Bryant & Dave O Hallaron from Carnegie Mellon
Processes Lecture 12, May 19 th 2011. Alexandre David Credits to Randy Bryant & Dave O Hallaron from Carnegie Mellon 1 Processes Defini=on: A process is an instance of a running program. One of the most
More informationCS , Fall 2008 Final Exam
Andrew login ID: Full Name: Recitation Section: CS 15-213, Fall 2008 Final Exam Friday. December 12, 2008 Instructions: Make sure that your exam is not missing any sheets, then write your full name, Andrew
More informationProcesses and Threads
COS 318: Operating Systems Processes and Threads Kai Li and Andy Bavier Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall13/cos318 Today s Topics u Concurrency
More informationRicardo Rocha. Department of Computer Science Faculty of Sciences University of Porto
Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto For more information please consult Advanced Programming in the UNIX Environment, 3rd Edition, W. Richard Stevens and
More informationvirtual memory. March 23, Levels in Memory Hierarchy. DRAM vs. SRAM as a Cache. Page 1. Motivation #1: DRAM a Cache for Disk
5-23 March 23, 2 Topics Motivations for VM Address translation Accelerating address translation with TLBs Pentium II/III system Motivation #: DRAM a Cache for The full address space is quite large: 32-bit
More informationExceptional Control Flow: Exceptions and Processes
Exceptional Control Flow: Exceptions and Processes 15-213 / 18-213: Introduction to Computer Systems 12 th Lecture, June 18, 2013 Instructors: Greg Kesden 1 Today Exceptional Control Flow Processes 2 Control
More informationCS 351 Sample Final Exam, Spring 2015
CS 351 Sample Final Exam, Spring 2015 Before starting the exam, make sure that you write and bubble in your student ID number (omitting the leading 'A') on the answer sheet in the field labeled "Student
More informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 24 LAST TIME Extended virtual memory concept to be a cache of memory stored on disk DRAM becomes L4 cache of data stored on L5 disk Extend page
More informationCSE351 Winter 2016, Final Examination March 16, 2016
CSE351 Winter 2016, Final Examination March 16, 2016 Please do not turn the page until 2:30. Rules: The exam is closed-book, closed-note, etc. Please stop promptly at 4:20. There are 125 (not 100) points,
More informationSystems Programming and Computer Architecture ( ) Timothy Roscoe
Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-6-) Timothy Roscoe Herbstsemester 26 AS 26 Virtual Memory 8: Virtual Memory Computer Architecture
More informationLecture 4: Memory Management & The Programming Interface
CS 422/522 Design & Implementation of Operating Systems Lecture 4: Memory Management & The Programming Interface Zhong Shao Dept. of Computer Science Yale University Acknowledgement: some slides are taken
More informationCarnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition
Carnegie Mellon 1 Concurrent Programming 15-213: Introduction to Computer Systems 23 rd Lecture, Nov. 13, 2018 2 Concurrent Programming is Hard! The human mind tends to be sequential The notion of time
More informationSignal types (some of them) Networks and Operating Systems ( ) Chapter 5: Memory Management. Where do signals come from?
ADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems (5-006-00) Chapter 5: Memory Management http://support.apple.com/kb/ht56 (Jul. 05) Description: The ios kernel has checks to validate that
More information15213 Recitation Section C
15213 Recitation Section C Nov. 18, 2002 Outline Robust I/O package Chapter 11 practice problems Important Dates Lab 6 Malloc: due on Thursday, Nov 21 Lab 7 Proxy: due on Thursday, Dec 5 Final Exam: Tuesday,
More informationVirtual Memory. Computer Systems Principles
Virtual Memory Computer Systems Principles Objectives Virtual Memory What is it? How does it work? Virtual Memory Address Translation /7/25 CMPSCI 23 - Computer Systems Principles 2 Problem Lots of executing
More information