Systems Programming and Process Management Lecture

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

1/19

flashcard set

Earn XP

Description and Tags

Flashcards covering systems programming concepts including process creation (fork), process replacement (exec), process synchronization (wait), and management of zombie and orphan processes.

Last updated 12:30 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

20 Terms

1
New cards

What is the distinction between a program and a process?

A program is an executable file, whereas a process is an instance of a program being executed.

2
New cards

What is systems programming as defined in the transcript?

Taking advantage of system calls to do things beyond standard C programming, such as creating multiple processes or communicating between programs.

3
New cards

What is a Process ID (PID) and which C type represents it?

A PID is a unique identifier for a process, represented in C by the pid_tpid\_t type.

4
New cards

Which process serves as the ancestor of every process on a Linux system?

The init process or systemdsystemd, which is process ID 1.

5
New cards

What are the three possible return values of the fork()fork() system call?

It returns a non-zero value (the child's PID) to the parent, zero to the child, or 1-1 if an error occurred.

6
New cards

What does the error code EAGAINEAGAIN indicate when returned by fork()fork()?

A system-imposed limit on the number of processes or threads was encountered.

7
New cards

What is the relationship between parent and child memory spaces after a fork()fork()?

The memory space is copied; they are separate processes and do not share memory in general.

8
New cards

What resources are shared between a parent and child process after a fork()fork()?

Open files, including standard input, standard output, and standard error.

9
New cards

What is 'line buffering' in the context of the C standard library?

Buffering where output is sent to the standard output only when a new line is encountered, typically used when outputting to a terminal.

10
New cards

When does the C standard library use 'block buffering' instead of 'line buffering'?

When the standard output is directed to a file or a pipe rather than a terminal.

11
New cards

What utility can check or set the limit on the maximum number of user processes?

ulimit uulimit\ -u

12
New cards

What is the difference between the exit()exit() library function and the \textunderscore exit() system call?

exit()exit() flushes output streams and runs exit hooks (atexitatexit), while \textunderscore exit() is the underlying system call that avoids these steps.

13
New cards

What is a zombie (defunct) process?

A process that has ended but remains in the process table because its parent has not yet reaped it to inquire about its exit status.

14
New cards

Why can one not 'kill' a zombie process?

Because the process has already ended and all its resources are claimed; it only exists as an entry in the process table until the parent calls waitwait.

15
New cards

What happens to a child process if its parent dies (an orphan process)?

It is inherited (adopted) by the original ancestor process (systemdsystemd, process ID 1).

16
New cards

What is the purpose of the wait()wait() system call?

To block the parent until a child process becomes a zombie, allowing the parent to reap the child and obtain its exit status.

17
New cards

Which macro is used to check if a process terminated normally in C?

WIFEXITED(status)WIFEXITED(status)

18
New cards

Which macro extracts the actual exit code from the status returned by wait()wait()?

WEXITSTATUS(status)WEXITSTATUS(status)

19
New cards

How does the WNOHANGWNOHANG option modify the behavior of waitpid()waitpid()?

It causes the function to return immediately if no child has exited, rather than blocking.

20
New cards

What happens to the calling process during a successful exec()exec() call?

The current program's memory is replaced by a new program, and the function never returns to the caller.