CMSC 125 - 5. Interlude: Process API

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/25

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

26 Terms

1
New cards

fork(), exec()

[Process creation and control in Unix]

  • Uses ____ and ____ system calls

2
New cards

wait()

[Process creation and control in Unix]

  • A process can wait for a process it has created using ______ system call

3
New cards

fork()

system call that creates a new process

4
New cards

address space, registers, PC

[fork()]

  • The newly created process has its own private copy of the _______, _______, and _______.

5
New cards

0

What should the value of rc be to be determined as a child (new process)

int rc = fork();

6
New cards

<0

What should the value of rc be to be determined as fork failed

int rc = fork();

7
New cards

>0

What should the value of rc be to be determined as a parent of child

int rc = fork();

8
New cards

0, child PID

fork() returns ______ to the child process and the ______ to the parent process

9
New cards

non-deterministic, scheduler

[fork()]

The order of execution of the parent and child processes is _________, dependent on the _______

10
New cards

wait()

This system call won’t return until the child has run and exited

11
New cards

deterministic

Adding the call to wait() on the code block for the parent process guarantees the ______ order of execution

12
New cards

exec()

Run a program that is different from the calling program

13
New cards

code, static data

[exec()]

The child process will have different ____, _____, address space, registers, PC

14
New cards
  • essential for building a shell

  • It allows the shell to alter the environment of the about to be run program by exec(), enabling more features (ex. Pipes and I/O redirection) to be implemented

Why separate fork() and exec()?

15
New cards

an “interface” program that accepts commands from users to access the services of the OS

16
New cards

BASH, ZSH

examples of shells in Linux

17
New cards

Command Prompt, Powershell

examples of shells in Windows

18
New cards

kill()

used to send signals to a process

19
New cards

SIGINT

pressing CTRL+c

20
New cards

SIGSTOP

pressing CTRL+z

21
New cards

SIGCONT

fg command

22
New cards

Signals subsystem

________ enable the delivery of events to processes

23
New cards

signal handlers, signal()

Processes and process groups can have ______ (via ______ system call) to perform a specific action whenever a specific signal is received

24
New cards

users

Processes are associated to ______ in order to provide ownership and control, as well as limited security and protection

25
New cards

getuid()

system call to return the user id of the user of the process calling it

26
New cards
  • main

  • top/htop

  • ps/pstree

  • kill/killall

  • fg/jobs

  • /proc

Useful programs and commands in Linux terminal