Download presentation
Presentation is loading. Please wait.
Published byAleksi Kokkonen Modified over 5 years ago
1
Overview of the Lab 1 Assignment: Multiplexing Inter-Process Communication
Chris Gill CSE 522S – Advanced Operating Systems Washington University in St. Louis St. Louis, MO 63143
2
CSE 522S – Advanced Operating Systems
Overall Design Server & clients work to reassemble a file from shuffled fragments A form of distributed merge sort Server loads a file listing fragments, then coordinates with clients Reads in and sends a fragment to each client as soon as that client connects When all fragments have been sent to clients, stops accepting new connections Reads back and merges streams of sorted (numbered) lines from clients Outputs the assembled file Clients process file fragments Each client reads in a stream of (numbered) lines from the server Stores lines then sorts them according to their line numbers Streams the (numbered) lines back to the server Server Client Client Client CSE 522S – Advanced Operating Systems
3
CSE 522S – Advanced Operating Systems
Server Nuances Server needs to multiplex events within a single thread of execution Using epoll() or select() or poll() to handle events from multiple sockets concurrently Dispatching a single call to accept() or read() or write() for each new event Stores and manage results dynamically Use malloc and free to support arbitrary numbers of clients, text lengths, numbers of text fragments, etc. Use dynamic, not static, data structures Don’t assume fixed sizes/numbers for things that may vary per program inputs Even with a single thread, work concurrently Small fragments of text are written/read Data structures store interim results Server stays busy (assuming client turnaround is reasonably quick) Server Event Loop select() accept() write() read() CSE 522S – Advanced Operating Systems
4
CSE 522S – Advanced Operating Systems
Client Nuances Client may be single-threaded without using an event multiplexing loop Workflow is largely sequential Stays busy once server starts feeding it data Stores and manage results dynamically Use malloc and free to support arbitrary lengths and numbers of text fragments, etc. Use dynamic, not static, data structures Don’t assume fixed sizes/numbers for things that may vary per program inputs Each read or write may send or receive only part of a buffer of data Need to manage pointers within linked list of text fragments, in order to make sure everything is sent This issue also affects server code Client workflow connect() while(!done) { read() } sort() write() close() CSE 522S – Advanced Operating Systems
5
CSE 522S – Advanced Operating Systems
Lab Write-up As you work, please record your observations in detail It’s a good idea to read the entire assignment, and to plan and design a bit before starting to work on it It’s also a good idea to develop and test incrementally Run different combinations of file lengths, #s of fragments Use the file fragmentation program that’s linked from the assignment to generate your own test cases Write a cohesive report that analyzes, integrates, and offers explanations for what you observed Document the thinking behind your design Attribute sources for any code or design ideas you obtained from elsewhere (caveat – only use what you understand, and know to be correct) Explain not only what you did and what you saw, but also why you did that, and why you think what you saw happened CSE 522S – Advanced Operating Systems
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.