Page 356 - DCAP103_Principle of operating system
P. 356
Unit 12: Processes and Threads in Windows
7. A pointer to the environment strings. Notes
8. A pointer to the name of the new process’ current working directory.
9. A pointer to a structure describing the initial window on the screen.
10. A pointer to a structure that returns 18 values to the caller.
Windows 2000 does not enforce any kind of parent-child or other hierarchy. All processes are
created equally (no processes are created more equal). However, since 1 of the 18 parameters
returned to the creating process is a handle to the new process (allowing considerable control
over the new process), there is an implicit hierarchy in terms of who has a handle to whom.
Although these handles cannot just be passed directly to other processes. There is a way for a
process to make a duplicate handle suitable for another process and then give it the handle, so
the implicit process hierarchy may not last long.
Each process in Windows 2000 is created with a single thread, but a process can create more
threads later on. Thread creation is simpler than process creation—CreateThread has only six
parameters instead of 10 such as:
1. The optional security descriptor.
2. The initial stack size.
3. The starting address.
4. A user-defined parameter.
5. The initial state of the thread (ready or blocked).
6. The thread’s ID.
The kernel does the thread creation, so it is clearly aware of threads (i.e., they are not implemented
purely in user space as is the case in some other systems).
How to differentiate between Job, Process, Thread and Fiber Management API
Calls?
12.1.3 Interprocess Communication
Threads can communicate in a wide variety of ways, including pipes, named pipes, mailslots,
sockets, remote procedure calls, and shared files. Pipes have two modes: byte and message,
selected at creation time. Byte-mode pipes work the same way as in UNIX. Message-mode pipes
are somewhat similar but preserve message boundaries, so that four writes of 128 bytes will be
read as four 128-byte messages, and not as one 512-byte message, as might happen with byte-
mode pipes. Named pipes also exist and have the same two modes as regular pipes. Named
pipes can also be used over a network; regular pipes cannot.
Mailslots are the features of Windows 2000, not present in UNIX. They are similar to pipes
in some ways, but not all. For one thing, they are one-way, whereas pipes are two-way. They
can also be used over a network but do not provide guaranteed delivery. Finally, they allow
the sending process to broadcast a message to many receivers, instead of to just one receiver.
LOVELY PROFESSIONAL UNIVERSITY 349