IPCsupporting
Inter-Process Communication (IPC) is fundamental for understanding how independent processes and threads cooperate and share data. Mastering various IPC mechanisms like pipes, shared memory, and message queues, along with synchronization primitives, is crucial for designing robust concurrent systems. Exams often test your ability to select appropriate IPC methods and identify potential issues like race conditions or deadlocks in multi-process scenarios.
Where to learn it
How to study it
- Thoroughly understand the differences, advantages, and disadvantages of various IPC mechanisms (e.g., pipes vs. shared memory vs. message queues).
- Practice implementing simple communication patterns using `ipc_pipes` and ensure a solid grasp of `pthread_lifecycle` for thread-based synchronization.
- Review the specific examples and problem scenarios presented in `slide_tutorial_r3-ipc_s058`, `s059`, `s064`, and `s066` to understand common pitfalls and solutions.
What the exam asks
Exam questions typically involve analyzing a given multi-process/multi-threaded scenario, identifying the most suitable IPC mechanism, or debugging synchronization issues.
The components, basic → advanced
These are the atomic skills this stage is built from. Learn them in this order — later ones assume the earlier ones.
Exam subsections in this stage (12 parts across 4 questions)
טבלת הקבצים וסנכרון
- 1· mcq· 3 pts
אילו מנגנונים/אובייקטים יכולים לשמש לתקשורת בין תהליכים (IPC)? א. סיגנלים (signals) ופסיקות (interrupts) ב. FIFOS ופסיקות (interrupts) ג. סיגנלים (signals) ומשתנים גלובליים (global variables) ד. Pipes וזיכרון משותף (shared memory) ה. זיכרון משותף (shared memory) ומשתנים גלובליים (global variables) ו. Pipes ומשתנים גלובליים (global variables)
libc syscall wrapper caching pitfallsLocal vs global interrupt disableSignal delivery and handler timingPipe IPC semanticsSRT / preemptive Gantt construction - 4· mcq· 2 pts
בחרו שורת קוד עבור שורה 6: א. write(my_pipe[1], “m”, 1); ב. read(my_pipe[0], buff, 1); ג. while(read(my_pipe[0], buff, 1)); ד. while(write(my_pipe[1], “m”, 1)); ה. buff[0] = 'm'; ו. שורה ריקה
Pipe IPC semantics - 5· mcq· 2 pts
בחרו שורת קוד עבור שורה 9: א. write(my_pipe[1], “m”, 1); ב. read(my_pipe[0], buff, 1); ג. while(read(my_pipe[0], buff, 1)); ד. while(write(my_pipe[1], “m”, 1)); ה. buff[0] = ''; ו. שורה ריקה
Pipe IPC semantics - 6· mcq· 2 pts
בחרו שורת קוד עבור שורה 12: א. write(my_pipe[1], “m”, 1); ב. read(my_pipe[0], buff, 1); ג. while(read(my_pipe[0], buff, 1)); ד. while(write(my_pipe[1], “m”, 1)); ה. buff[0] = 'm'; ו. שורה ריקה
Pipe IPC semantics - 7· mcq· 2 pts
בחרו שורת קוד עבור שורה 7: א. read(my_pipe[0], buff, 1); ב. while(c--) read(my_pipe[0], buff, 1); ג. read(my_pipe[0], buff, --c); ד. write(my_pipe[1], “m”, 1); ה. while(c--) write(my_pipe[1], “m”, 1); ו. שורה ריקה
Pipe IPC semantics - 8· mcq· 2 pts
בחרו שורת קוד עבור שורה 10: א. read(my_pipe[0], buff, 1); ב. while(c--) read(my_pipe[0], buff, 1); ג. read(my_pipe[0], buff, --c); ד. write(my_pipe[1], “m”, 1); ה. while(c--) write(my_pipe[1], “m”, 1); ו. שורה ריקה
Pipe IPC semantics - 9· mcq· 2 pts
בחרו שורת קוד עבור שורה 13: א. read(my_pipe[0], buff, 1); ב. while(c--) read(my_pipe[0], buff, 1); ג. read(my_pipe[0], buff, --c); ד. write(my_pipe[1], “m”, 1); ה. while(c--) write(my_pipe[1], “m”, 1); ו. שורה ריקה
Pipe IPC semantics
תקשורת בין תהליכים
- 1· diagram· 5 pts
להלן דיאגרמה של טבלת הקבצים הפתוחים ברגע הכניסה לפונקציה main: [Diagram] (5 נק') השלימו את כל ההצבעות החסרות באיור הבא, בהינתן שתהליך האב סיים לבצע את שורה 19 ותהליך הבן סיים לבצע את שורה 15: [Diagram]
fork/exec address-space semanticslibc syscall wrapper caching pitfallsSignal delivery and handler timing - 2· mcq· 5 pts
(5 נק') מה יודפס למסך בסיום ריצת שני התהליכים? (הניחו שקריאות המערכת אינן נכשלות) a. Hi b. Bye c. HiBye d. לא יודפס כלום e. התהליך לא יסתיים לעולם f. לא ניתן לדעת, תלוי בתזמון של התהליכים נימוק:
libc syscall wrapper caching pitfalls - 3· mcq· 5 pts
(5 נק') מה יודפס למסך כאשר תהליך האב יסיים לרוץ? (הניחו שקריאות המערכת אינן נכשלות) רמז: שרטטו דיאגרמה של טבלאות הקבצים כפי שראיתם בסעיף 1. a. Hi b. Bye c. HiBye d. ByeHi e. לא יודפס כלום f. לא ניתן לדעת, תלוי בתזמון של התהליכים נימוק:
libc syscall wrapper caching pitfalls
שאלה 2 - תהליכים