Exam 2 Study guide

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

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

25 Terms

1
New cards

System calls

  • used to request a server from an OS kernel

  • a core component of both linux and windows

  • are made with a special machine instruction


2
New cards

File descriptors

an index of type int for a table of open files

3
New cards

Short count

the read() or write() system calls are unable to read or write the number of bytes requested

4
New cards

const

the function will not modify the data pointed to by the pointer x

5
New cards

pipe (the | symbol)

redirects a program’s standard out to another program’s standard in

6
New cards

Do C i/o fucntion fread() and fwrite() use system calls? If so, when?

They primarily use system calls when a buffer needs to be filled or emptied

7
New cards

When is write() used with unbuffered C file streams to copy data to the underlying file?

Any time the file stream is written to

8
New cards

What is false about erno?

It is a kernel variable that can only be read and written using system calls


9
New cards

What features does GNU Debugger have?

It allows you to pause and resume execution of a program and inspect variables to locate bugs.

10
New cards

What is false virtual memory?

It can never be larger than physical RAM

11
New cards

What is a process’s stack memory segment used for? What data does it store?

Function parameters, local vars and CPU state

12
New cards

What is a process’s environment?

A set of name=value strings

13
New cards

How does malloc work?

It fills memory requests from unused heap space; or expands the heap with brk() if needed

14
New cards

Signals may be generated due to

  • processes terminating

  • in response to hardware exceptions

  • in response to user activity

  • system calls


15
New cards

A signal’s disposition may be set to

default action, ifgore, or a handler function

16
New cards

What is the purpose of the signal mask?

signal numbers set in the mask are blocked and will remain pending rather than be delivered

17
New cards

The smallest unit of code that can’t be interrupted by a signal handler is?

a single machine instruction

18
New cards

SIGKILL and SIGTERM are both intended to terminate a process. What’s the difference between them?

SIGKILL can’t be caught/handled or blocked

19
New cards

exit handlers

never interrupt normal program flow the way a signal handler does

20
New cards

int main(void) {

int f = fork();

if (f == 0) { //child

printf("1");

} else if (f > 0) { //parent

printf("2");

}

printf("B"); }

21BB, 12BB, 2B1B, 1B2B

21
New cards

The wait family of functions

allows a process to collect a status from a terminated child process

22
New cards

What is considered abnormal termination of a process?

When a signal is delivered with default disposition requiring termination

23
New cards

What happens to orphaned processes?

They are adopted by the system init process

24
New cards

What is a race condition?

When two processes, or a signal handler and other parts of a program access the same resource, and program output depends on which runs first

25
New cards

What does execve() do?

It executes a new program by overwriting the code and data of the process that called it