Pipes and System Calls Lecture Notes

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/17

flashcard set

Earn XP

Description and Tags

Practice questions and answers based on the lecture covering pipe system calls, file descriptor management, process inheritance, and the UQ Make Light assignment overview.

Last updated 12:33 AM on 6/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

18 Terms

1
New cards

What arguments must be passed to the pipe system call?

An array of two integers.

2
New cards

In a pipe array, which index represents the read end and which represents the right end?

The first entry (index 0) is the read end and the second entry (index 1) is the write end.

3
New cards

What command is used to view user settable limits, such as the maximum number of open files?

ulimitaulimit -a

4
New cards

What is the standard maximum number of open file descriptors for most user accounts mentioned in the lecture?

1024

5
New cards

Why is it critical for each process to close the unused end of a pipe after a fork?

To ensure that the reading end can correctly detect the end of file (EOF) once the last writer closes its descriptor.

6
New cards

What does the wait(NULL) system call accomplish in the parent process?

It waits for any child process to finish and reaps it.

7
New cards

What is the result of using printf with a percent s format on a buffer containing null terminators mid-stream?

It will stop printing at the first null terminator, treating it as the end of the string.

8
New cards

What utility can be used to attach to a running process and witness its system calls?

stracep<PID>strace -p <PID>

9
New cards

Where in the Linux virtual file system can you find information about the file descriptors open by process ID 3643579?

(lsl)/proc/3643579/fd(ls -l) /proc/3643579/fd

10
New cards

What function allows for formatted printing directly to a file descriptor instead of a file stream?

dprintfdprintf

11
New cards

Which system call is used to duplicate a file descriptor and redirect it to standard input or output?

dup2dup2

12
New cards

What happens to a child process if its parent finishes first?

It becomes an orphan process and is inherited by process ID 1, which reaps it immediately upon completion.

13
New cards

What signal is sent to a process if it attempts to write to a pipe with no active reading end?

SIGPIPESIGPIPE (often resulting in exit code 141).

14
New cards

Which function converts an existing file descriptor into a wrapper file stream (FILEFILE*)?

fdopenfdopen

15
New cards

Which function is used to retrieve the underlying file descriptor from a file handle?

filenofileno

16
New cards

Why is calling fdopen inside a function and losing track of the pointer dangerous?

It results in memory leaks and potential data loss because the associated buffer may contain unconsumed data from the file descriptor.

17
New cards

In the context of the UQ Make Light assignment, what system call is used to check for a file's existence and modification timestamp?

statstat

18
New cards

In a shell environment, which command’s exit status is typically reported for a pipeline of multiple commands?

The exit status of the last command in the pipe.