Title: Describe the concept of lightweight process (LWP) and the advantages to using LWPs
1Describe the concept of lightweight process (LWP)
and the advantages to using LWPs
- Lightweight process (LWP) lies in a hybrid form
of user-level kernel-level threads. LWP runs in
the context of a single (Heavy-weight) process,
and there can be several LWPs per process. In
addition to having LWPs, a system also offers a
user-level thread package. - The combination of (user-level) threads and LWPs
works as follows - The thread package has a single routine to
schedule the next thread - When LWP is created, it is given its own stack
and is instructed to execute the scheduling
routine in search of a thread to execute - Thread table is shared by LWPs. Synchronization
is realized by mutexes implemented entirely in
user space. - Advantages to using LWPs in combination with
user-level thread - Creating, destroying, and synchronizing threads
is relatively cheap and involves on kernel
intervention at all - A blocking system call will not suspend the
entire process, provided that a process has
enough LWPs. - There is no need for an application to know about
the LWPs. All it sees are user level threads. - LWPs canbe easily used in multiprocessing
environments by executing different LWPs on
different CPUs
2Having only a single lightweight process per
process is not such a good idea. Why not?
- See page 140-141 of the core book (Tanebaum 2002).
3Give an example to show the advantages to using
multithreaded Clients
- See page 142 of the core book (Tanebaum 2002).
4Compare the multithreaded file server based on
dispatcher/worker model and a single threaded
file server introduced during the lecture time
tell the advantages to using the multithreaded
technique in server designing.
- See page 143-144 of the core book (Tanebaum 2002).
5Explain what is so called stateless server, and
stateful server? Give examples
- A stateless server does not keep information on
the sate of its clients, and can change its own
state without having to inform any client, e.g. A
Web Server. - A stateful server does maintain information on
its clients, e.g. a file server that allows a
client to keep a local copy of a file. - See page 151 of the core book (Tanebaum 2002).
6For better understanding the code migration, a
process is used to be modelled as a three
segments model. What are these three segments?
- Code segment is the part that contains the set of
instructions that make up the program that is
being executed. - Resource segment contains references to external
resources needed by the process, such as file,
printers, devices, other processes, and so on. - Execution segment is used to store the current
execution state of a process, consisting of
private data, the stack, and the program counter.
7For code migration in distributed system, explain
what are the weak mobility model and the strong
mobility model? What are the sender-initiated
mobility and the receiver-initiated mobility?
- Weak mobility model In this model, it is
possible to transfer only the code segment, along
with perhaps some initialization data. Feature a
transferred program is always started from its
initial state, e.g. Java applets. - Strong mobility model Besides the code segment
being transferred, the execution segment can be
transferred as well. Feature A running process
can be stopped, subsequently moved to another
machine, and then resume execution where it left
off. -
- In sender-initiated migration, migration is
initiated at the machine where the code currently
resides or is being executed. - In receiver-initiated migration, the initiative
for code migration is taken by the target
machine
8List all the alternatives for code migration.