CIS-4020 Homework #4: Processes

Due: Thursday, September 22, 2016

In the text read Chapter 3. This chapter also supports Lab #3.

  1. Answer the following questions about task states (Chapter 3 in the text describes these states).

    1. When a process is running what event(s) cause it to become blocked?
    2. When a process is blocked what event(s) cause it to leave the blocked state?
    3. In Linux what is the difference between the TASK_INTERRUPTABLE and TASK_UNINTERRUPTABLE states?
  2. This question will require you to inspect the details of struct task_struct. Use cscope to locate the structure definition in the kernel source.

    Every process has a "real" user ID (uid) and an "effective" uid. The real uid is the user who launched the process. The effective uid might be different in some cases. For example if the user starts a setUID program the effective uid of the created process is that of the executable file's owner. This is how users can do things like change their password that normally require root access: the passwd program is setUID and owned by root.

    Inside the kernel the pointer current points at the task_struct for the "current" process. Using current how would you access the process's real and effective uids? I'm looking for two short C expressions such as might be used in a module. HINT: Look at the process credential fields in the definition of task_struct.

  3. What are the differences between user threads and kernel threads? What are the advantages and disadvantages of user threads? CAUTION: In the context of this question "kernel threads" are threads managed by the kernel... not to be confused with threads that execute entirely inside the kernel as described in Chapter 3 of the text! There is an unfortunate overloading of the phrase "kernel thread," and for this question I'm using the meaning other than the one the book uses.

    HINT: Look up "user thread vs kernel thread" or read about the GNU Portable Thread library (A user thread library).

  4. Originally the Linux kernel was not preemptable. What does this mean? What advantage does this design have? Does the lack of preemption cause any problems for applications? (The last question is a bit tricky since it is possible to argue the case either way. I'm interested in your reasoning about the issue, not a simple yes/no answer).


Last Revised: 2016-09-10
© Copyright 2016 by Peter C. Chapin <PChapin@vtc.vsc.edu>