Question

What is a process A. what does it contain     B.what are its various states C....

  1. What is a process

    A. what does it contain     B.what are its various states C. what is contained in a PCB. D. Describe what happens when a process is created
  2. What is a thread.

    A. What are multi threaded processes ? B. What are the benefits of threads. Describe them in detail.
  3. Describe the items shared by all threads in a process. What are the items which are private to each thread.

  4. On all current computers, at least part of the interrupt handlers are written in assembly language. Why?

Homework Answers

Answer #1

A process is a program in execution. A process memory has four sections:
1) Text section is made up of the compiled program code.
2) Data section is made up the global and static variables
3) Heap is used for the dynamic memory allocation
4) Stack is used for local variables.
There are five different states in a process:
1) NEW- The process is being created.
2) READY- The process is waiting to be assigned to a processor.
3) RUNNING- Instructions are being executed.
4) WAITING- The process is waiting for some event to occur.
5) TERMINATED- The process has finished execution.
PCB contains:
    Process State: It can be running, waiting etc.
    Process ID and the parent process ID.
    CPU registers and Program Counter. Program Counter holds the address of the next instruction to      be executed for that process.
    CPU Scheduling information: Such as priority information and pointers to scheduling queues.
    Memory Management information: For example, page tables or segment tables.
    Accounting information: The User and kernel CPU time consumed, account numbers, limits, etc.
    I/O Status information: Devices allocated, open file tables, etc.
A process may be created by another process using fork(). The creating process is called the parent process and the created process is the child process. A child process can have only one parent but a parent process may have many children. Both the parent and child processes have the same memory image, open files and environment strings. However, they have distinct address spaces.

Thread:
A thread is a path of execution within a process and a process can have multiple threads.
Multithreading processes is a process of executing multiple threads simultaneously managed by OS.
The benefits of multithreading is categorized into four:
1) Resource Sharing: All the threads of a process share its resources such as memory, data, files etc. A single application can have different threads within the same address space using resource sharing.
2) Responsiveness: Program responsiveness allows a program to run even if part of it is blocked using multithreading. This can also be done if the process is performing a lengthy operation. For example - A web browser with multithreading can use one thread for user contact and another for image loading at the same time.
3) Utilization of Multiprocessor Architecture: In a multiprocessor architecture, each thread can run on a different processor in parallel using multithreading. This increases concurrency of the system. This is in direct contrast to a single processor system, where only one process or thread can run on a processor at a time.
4) Economy: It is more economical to use threads as they share the process resources. Comparatively, it is more expensive and time-consuming to create processes as they require more memory and resources. The overhead for process creation and management is much higher than thread creation and management.
Items shared by all threads in a process are:  
    -Text segment (instructions)
    -Data segment (static and global data)
    -BSS segment (uninitialized data)
    -Open file descriptors
    -Signals
    -Current working directory
    -User and group IDs
Items which are private to each thread are:
    -Thread ID
    -Saved registers, stack pointer, instruction pointer
    -Stack (local variables, temporary variables, return addresses)
    -Signal mask
    -Priority (scheduling information)

On all current computers, at least the interrupt handlers are partially written in assembly language because assembly language can produce more efficient procedures. Assembly languages are considered to be the most powerful computer language since it operates directly on the physical CPU. When an assembler reads a program, it converts each line of code into one CPU-level instruction. The assembler converts the executable code into a format that the computer would directly understand. Assembly language corresponds directly between the language and the physical machine instruction. This is a powerful language that can assist programmer to create commands as the machine language but in a more readable and manageable manner. Creating an interrupt handler in an assembly language allows the program to be performed in higher speed than higher level language. So part of the interrupt handlers are written in assembly language.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT