COMP 3430 Operating Systems
IPC – pipes
February 11th, 2022
Copyright By PowCoder代写 加微信 powcoder
By the end of today’s lecture, you should be able to:
▶ Describe what responsibilities an OS has in terms of implementing signals, pipes, and FIFOs.
▶ Compare and contrast regular files with pipes.
The Rocket Book (Public Domain)
Pipes: better?
Let’s do a quiz.
More like this kind of pipe. ©
Pipes: better?
Let’s take a look at some examples.
1. Anonymous pipes. (anonymous_pipe.c) 2. Named pipes. (client.c and server.c)
Based on the code, which should be run first?
▶ client.c ▶ server.c
Let’s try some stuff out.
▶ Run the server and client.
▶ Write to the FIFO with cat (not the client).
▶ Look at the FIFO with ls -lh. ▶ Try run this on aviary.
▶ Run it with cat on both ends of the pipe.
▶ Someone else write to my pipe.
What’s the kernel doing?
▶ The kernel mediates this whole process. ▶ Think about it: What kind of data
structures might the kernel use to
implement pipes?
▶ Let’s take a look at pipe.c
Again: a bit more than this, I hope. (Pixabay License)
Find out where the pipe system call is implemented. Follow the path to see if you can find out when the file descriptors array is populated.
Note the names of common struct that you see!
Let’s look at struct pipe_inode_info and struct pipe_buffer together. Both are in pipe_fs_i.h.
Pipes are much more flexible than signals.
▶ We can actually get information with the message.
▶ … but we still need structure (protocols) (COMP 3010)
▶ Kernel still mediates the whole process. ▶ Highly similar to sockets.
Let’s take a look at the schedule.
It’s a clock. (Public Domain)
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com