OS
Threads and Synchronization
Networking
Shell Project
Software Engineering
100

This mode allows the CPU to run any instruction and access any memory location, and is where OS services run.

What is kernel mode?
100

This is a software mechanism, used to ensure that only one thread can execute a critical section of code at a time.

What is a Mutex Lock?

100

This protocol is responsible for translating human-readable hostnames into IP.

What is DNS?

100

In a shell script, "$*" is used for this purpose

What is accessing all command-line arguments passed to the script?

100

This type of software development tool (e.g., Git, SVN) is essential for team collaboration, tracking changes, and managing different versions of code.

What is Source Control?

200

This is the OS subsystem responsible for deciding which process to run next and performing context switches.

What is the Process Scheduler?

200

This term describes a data structure or function that can be safely used by multiple threads concurrently without causing issues like race conditions.

What is Thread-Safe?

200

This transport protocol provides reliable, connection-oriented, full-duplex stream communication.

What is TCP?

200

This system call is used by a parent process to create a new child process that is initially a copy of the parent.

What is fork()?

200

This testing practice involves writing tests before writing the actual code to implement a feature.

What is "Code unit-test first"?

300

This type of scheduling allows a running process to be interrupted by the OS, typically after a time quantum expires, to allow other processes to run.

What is Preemptive Scheduling?

300

This synchronization primitive is initialized with a counter and allows a specified number of threads to pass

What is semaphore?

300

This technology allows multiple computers on a private network to share a single public IP address and often acts as a firewall.

What is NAT?

300

When implementing wildcard expansion like *.c, this POSIX function can be used to compile a wildcard pattern into a regular expression.

What is regcomp()?

300

This design pattern encapsulates a command request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.

What is the Command Pattern?

400

Describe the primary contents of an entry in the Process Table.

What is PID, command & arguments, environment variables, current directory, owner (UID), stdin/stdout/stderr, list of memory mappings, list of open files, and for each thread: PC, registers, stack, and state?

400

When two or more threads are blocked forever, each waiting for a resource held by another thread in the cycle.

What is a deadlock?

400
The four things needed to connect to the internet

What are:

The local IP address

The subnet mask

The default router

The default DNS server

400

Describe the implementation of subshells.

What is: 1. The parent shell creates two pipes (e.g., pin for input to the subshell, pout for output from the subshell). 2. The parent forks a child process. 3. The child process redirects its standard input to read from pin[0] and its standard output to write to pout[1]. It closes unused pipe ends. 4. The child process then often executes an instance of the shell itself (e.g., via /proc/self/exe) to parse and run the command string within the backticks. 5. The parent shell writes the command string (e.g., "cat a.out") followed by a newline and often an "exit" command to pin[1] and closes pin[1]. 6. The parent shell reads the output of the subshell command from pout[0] into a buffer until EOF. 7. This buffered output is then substituted as an argument (or arguments, if split by spaces) into the original command line.

400
Practices regarding "testing" in extreme programming

All code must have uni tests

All code must pass all unit tests before integration

When a bug is found create a test.

Create acceptance tests

500

Explain the steps involved when a user program makes a system call, including the transition between modes and the role of the interrupt handler.

What is:
1. User program calls a library wrapper function (e.g., open() in libc).
2. Library wrapper executes a special software interrupt instruction.
3. CPU switches from User Mode to Kernel Mode.
4. The OS's system call interrupt handler is invoked.
5. The handler identifies the specific system call, validates arguments, and performs security checks.
6. The OS executes the requested service.
7. Results are returned to the library wrapper, and the CPU switches back to User Mode.
8. The library wrapper returns to the user program.

500

Describe how a Read/Write lock works and in what scenario it is more advantageous than a simple mutex lock.

What is: A Read/Write lock allows multiple threads to read a shared resource simultaneously (multiple readers) but ensures that only one thread can modify (write to) the resource at a time, excluding all readers and other writers. It is advantageous when read operations are much more frequent than write operations.

500

The process TCP uses to establish and close connections to ensure reliability

What is the three-way handshake 

500

Explain how I/O redirection (e.g., ls -l > output.txt) and pipes (e.g., ls -l | grep myFile) are typically implemented in a shell

Any acceptable answer

500
Items in Joel's test

Do you use source control?

Can you make a build in one step?

Do you make daily builds?

Do you have a bug database?

Do you fix bugs before writing new code?

Do you have an up-to-date schedule?

Do you have a spec?

Do programmers have quiet working conditions?

Do you use the best tools money can buy?

Do you have testers?

Do new candidates write code during their interview?

Do you do hallway usability testing?

M
e
n
u