CPU-api Flashcards

1
Q

Why is exec useful?

A

If you want to run a program that is different from the calling programing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does exec() do?

A

It loads code (and static data) from that executable and overwrites its current code segment (and current static data) with it; the heap and stack and other parts of the memory space of the program are re-initialized. A successful call to exec() never returns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain what the shell is

A

It is a user program. It shows you a prompt and then waits for you to type something in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain what the shell is

A

It is a user program. It shows you a prompt and then waits for you to type something into it. Can execute files by typing a command into it, then shell figures out where in the file system the executable resides. Calls fork(), calls exec(), then waits(), When child completes the shell returns from wait and prints out a prompt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does wc p3.c > newfile.txt do?

A

Output of the program wc is redirected into the output fil newfile.txt. Shell closes the stdoutput before calling exec and opens file newfile.txt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Name an example of a shell

A

Bash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does kill() sustem call do?

A

It send signals to a process, including directives to go to sleep, die, and other useful imperatives.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does top, MenuMeters show?

A

See how much CPU is being utilized at any moment in time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly