COMP 3430 Operating Systems
FIFOs and Scheduling part 1
February 14th , 2022
Copyright By PowCoder代写 加微信 powcoder
By the end of today’s lecture (and readings), 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 take a look at some examples.
1. Anonymous pipes. (anonymous_pipe.c)
2. Named pipes. (client.c and server.c)
More like this kind of pipe. ©
Try it out
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?
Again: a bit more than this, I hope. (Pixabay License)
▶ The kernel mediates this whole process. ▶ Think about it: What kind of data
structures might the kernel use to implement pipes?
▶ Where do we start??? Start with strace!
▶ Let’s take a look at pipe.c
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.
Remember: pipe() takes an array of 2 int, these are “file descriptors”!
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.
▶ Signals: useful, but limited.
▶ Pipes: powerful, more difficult to use.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com