Explain how writing UNIX in C made it easier to port it to new machines.
The POSIX interface defines a set of library procedures.
Explain why POSIX stan-
dardizes library procedures instead of the system-call interface.
Linux depends on gcc compiler to be ported to new architectures. Describe one advan-
tage and one disadvantage of this dependency.
A directory contains the following files:
Which files will be listed by the command
What does the following Linux shell pipeline do?
grep nd xyz | wc –l
Write a Linux pipeline that prints the eighth line of file
on standard output.
Why does Linux distinguish between standard output and standard error, when both
default to the terminal?
A user at a terminal types the following commands:
After the shell has processed them, how many new processes are running?
When the Linux shell starts up a process, it puts copies of its environment variables,
, on the process’ stack, so the process can find out what its home direc-
If this process should later fork, will the child automatically get these vari-
About how long does it take a traditional UNIX system to fork off a child process
under the following conditions: text size = 100 KB, data size = 20 KB, stack size = 10
KB, task structure = 1 KB, user structure = 5 KB. The kernel trap and return takes 1
msec, and the machine can copy one 32-bit word every 50 nsec. Text segments are
shared, but data and stack segments are not.
As multimegabyte programs became more common, the time spent executing the
system call and copying the data and stack segments of the calling process grew
is executed in Linux, the parent’s address space is not cop-
ied, as traditional
semantics would dictate. How does Linux prevent the child from
doing something that would completely change the
CASE STUDY 1: UNIX, LINUX, AND ANDROID
Why are negative arguments to
reserved exclusively for the superuser?
A non-real-time Linux process has priority levels from 100 to 139. What is the default
static priority and how is the nice value used to change this?
Does it make sense to take away a process’ memory when it enters zombie state?
or why not?
To what hardware concept is a signal closely related?
Give two examples of how sig-
nals are used.
Why do you think the designers of Linux made it impossible for a process to send a
signal to another process that is not in its process group?
A system call is usually implemented using a software interrupt (trap) instruction.
Could an ordinary procedure call be used as well on the Pentium hardware? If so,
under what conditions and how? If not, why not?
In general, do you think daemons have higher or lower priority than interactive proc-
When a new process is forked off, it must be assigned a unique integer as its PID.
sufficient to have a counter in the kernel that is incremented on each process creation,
with the counter used as the new PID? Discuss your answer.
In every process’ entry in the task structure, the PID of the parent is stored. Why?
The copy-on-write mechanism is used as an optimization in the
system call, so that
a copy of a page is created only when one of the processes (parent or child) tries to
write on the page. Suppose a process
in quick succession.
Explain how a page sharing may be handled in this case.
What combination of the
bits used by the Linux clone command corre-
sponds to a conventional UNIX
call? To creating a conventional UNIX thread?
Two tasks A and B need to perform the same amount of work. However, task A has
higher priority, and needs to be given more CPU time. Expain how will this be
achieved in each of the Linux schedulers described in this chapter, the O(1) and the
Some UNIX systems are tickless, meaning they do not have periodic clock interrupts.
Why is this done? Also, does ticklessness make sense on a computer (such as an em-
bedded system) running only one process?
When booting Linux (or most other operating systems for that matter), the bootstrap
loader in sector 0 of the disk first loads a boot program which then loads the operating
system. Why is this extra step necessary? Surely it would be simpler to have the boot-
strap loader in sector 0 just load the operating system directly.
A certain editor has 100 KB of program text, 30 KB of initialized data, and 50 KB of
BSS. The initial stack is 10 KB.
Suppose that three copies of this editor are started si-
multaneously. How much physical memory is needed (a) if shared text is used, and (b)
if it is not?
Why are open-file-descriptor tables necessary in Linux?