Question

In: Computer Science

Describe the items shared by all threads in a process. What are the items which are...

  1. Describe the items shared by all threads in a process. What are the items which are private to each thread.

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

Solutions

Expert Solution

ANS 1)

The items that are shared by all threads in a process are:-

  1. Global Variables:- Since they are of the same process, they all share the global variables.
  2. Heap:- Since global variables are stored in heap, the heap is shared among threads.
  3. Address Space:- A process has an address space that has program text and data and other resources as well. these include Child Processes, Open Files, Pending Alarms, Signal Handlers, and more.

Items that are private to each thread are:-

  1. Program Counter
  2. Registers
  3. Stack
  4. State

ANS 2)

When the interrupts start, they save the registers in the process table entry for the current ongoing process. The information pushed onto the stack by the interrupt is then removed and the stack pointer is then set to point at a temporary stack which is being used by the process handler. These actions like saving registers, setting the stack pointer can't be written/expressed in HLL such as C++,C, Java, so these are performed by assembly-language routine which is usually the same for all interrupts as the work of saving registers is identical.


Related Solutions

Task 4 [10 pts] Broadcasting Messages to All Clients (Shared Variable Among Threads) Modify the server...
Task 4 [10 pts] Broadcasting Messages to All Clients (Shared Variable Among Threads) Modify the server code so that when the server sends a message, that message is sent to all connected clients #include<stdio.h> #include<string.h> //strlen #include<stdlib.h> //strlen #include<sys/socket.h> #include<arpa/inet.h> //inet_addr #include<unistd.h> //write #include<pthread.h> //for threading , link with lpthread #define MAX 80 #define PORT 6543 #define SA struct sockaddr // Function designed for chat between client and server. void join( pthread_t *thread_id) { if(!pthread_join( *thread_id , NULL)) printf("thread %ld...
Which of the following items describe a mole? Select all that apply.
  Which of the following items describe a mole? Select all that apply. Avogadro's number of items 6.022 × 1023 items mass × acceleration The amount of a substance containing the same number of formula units as there are atoms in 12 g of carbon.
What was the process by which ASU 2016-1 proposed changes were shared with the business, accounting,...
What was the process by which ASU 2016-1 proposed changes were shared with the business, accounting, and investment communities?
Which of the following statements about sharing data by threads is (are) correct? Select all that...
Which of the following statements about sharing data by threads is (are) correct? Select all that apply. (a) When kernel-mode threads in a process share data, a race condition will not occur, since threads are managed operating systems. (b) When kernel-mode threads in a process share data, a race condition can occur and therefore, a semaphore (or semaphores) should be used to prevent race conditions. (c) When user-mode threads in a process share data, a race condition will not occur,...
Section 28.4 Describe the three key characteristics shared by all the major groups of mollusks. Describe...
Section 28.4 Describe the three key characteristics shared by all the major groups of mollusks. Describe the following classes of mollusks. Give examples of each. Bivalves: Gastropods: Cephalopods: How do cephalopods differ from other mollusks in terms of their nervous system, reproduction, locomotion, and mode of obtaining food? Describe the defining characteristics of annelids and distinguish between the two classes of annelids. Provide examples of each.
Which protocol layer defines the process by which LAN devices can access the shared medium?
  Which protocol layer defines the process by which LAN devices can access the shared medium?     a. MAC     b. LLC     c. physical layer     d. IP Select the correct statement(s) regarding the use of DSSS and OFDM on IEEE 802.11 WLANs.     a. DSSS and OFDM are more spectrally efficient than traditional FDM     b. DSSS and OFDM are both spread spectrum techniques that are easy to implement and less complicated...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor environment? Justify your answer
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor environment? Justify your answer.
Describe the features shared by all mammals. Then, differentiate between the reproductive strategies of Monotremes, Marsupials,...
Describe the features shared by all mammals. Then, differentiate between the reproductive strategies of Monotremes, Marsupials, and Placentals. Do you think the life history of any of these groups is superior to the others? Why/why not?
You have a collection of unique items which all implementComparable. The items need to be...
You have a collection of unique items which all implement Comparable. The items need to be kept sorted at all times. It is important that the items can be queried for as fast as possible. Which Collection is most suitable?TreeMapHashSetTreeSetHashMap
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT