Linux Tutorials 1+2 Flashcards

(20 cards)

1
Q

What is a device controller?

A

A piece of hardware that manages a specific I/O device (like keyboard, disk, or printer). It has registers that the CPU uses to send commands and check status.

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

What does the PC (Program Counter) register do?

A

It stores the address of the next instruction to be executed.

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

What does the IR (Instruction Register) do?

A

It stores the current instruction that is being executed.

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

What is polling in I/O?

A

The CPU repeatedly checks a device to see if it is ready. This wastes CPU time.

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

What is interrupt-driven I/O?

A

The device notifies the CPU when it is ready, so the CPU can do other work in the meantime.

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

Which is more efficient, polling or interrupts?

A

Interrupts are more efficient because the CPU does not waste time constantly checking the device.

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

What does the ‘ls’ command do in Unix?

A

Lists files and directories in the current directory.

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

What does the ‘cat’ command do?

A

Displays the contents of a file.

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

What does the ‘mkdir’ command do?

A

Creates a new directory.

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

What does the ‘rm’ command do?

A

Removes (deletes) a file. With -r, it removes a directory.

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

What does the ‘cd’ command do?

A

Changes the current working directory.

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

How do you create a C source code file using vi?

A

Type ‘vi filename.c’, press ‘i’ to insert, write the code, press ESC, then ‘:wq’ to save and quit.

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

How do you compile a C program from the command line?

A

Use ‘gcc filename.c -o programname’.

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

How do you run a compiled C program?

A

Type ‘./programname’ in the terminal.

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

What does argc mean in C programs?

A

It is the number of command-line arguments passed to the program.

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

What does argv mean in C programs?

A

It is an array of strings containing the arguments themselves.

17
Q

What does init() do in Unix?

A

It is the first process started by the system. It sets up all other processes.

18
Q

What does fork() do?

A

It creates a new process by duplicating the current one. The new one is called the child process.

19
Q

What does getpid() do?

A

Returns the process ID (PID) of the current process.

20
Q

What does getppid() do?

A

Returns the process ID (PID) of the parent process.