1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
11Alexandr11 [23.1K]
3 years ago
7

There are two main advantages to using multiple threads in a process: 1) Less work involved in creating a new thread rather than

a new process 2) Communication among threads within the same process is simplified. Briefly explain how threads give these advantages. Is it also true to say that context switching between two threads in the same process involves less work than switching to a thread in a different process?
Computers and Technology
1 answer:
Brums [2.3K]3 years ago
7 0

Answer:

Thread is a light weight where as Process is a heavy weight in nature

Explanation:

A process can use to accomplish complex tasks which involves utilization of more system resources. Thread is  part of process which is used to accomplish some smaller task. Thread is light weight and involves utilization of less no of resources.

A process can have more than one thread for execution. we can execute these threads in a process parallelly. This is known as Multi Threading.

There are Mainly 2 Advantages to using multi threads in a process

Less work Involved in creating New Thread rather than a New process: this is because all threads in a process use same address space so it is very easy to communicate and operate these threads in a process. Each process is used separate address space so if we want to create another process then it involves utilization of more resource so more overhead

Communication among threads in same process also simplified as these are using same address space

You might be interested in
Proponents of Internet freedom see its _____________ as providing protection for unpopular expression; proponents of greater Int
diamong [38]

Answer:

anonymity

Explanation:

<h2><u>Fill in  the blanks </u></h2>

Proponents of Internet freedom see its <u>anonymity </u>as providing protection for unpopular expression; proponents of greater Internet control see it as the Internet's greatest danger.

6 0
3 years ago
5.4.6: Rolling Dice code
ziro4ka [17]
It is 15 all together
4 0
3 years ago
Write a program that allow a customer to input the value of goods bought, The program should then decide the discount to give a
Thepotemich [5.8K]

Answer:

geeksforgeeks is the answer

5 0
2 years ago
Below, we’ve provided a for loop that sums all the elements of list1. Write code that accomplishes the same task, but instead us
Tanzania [10]

Answer:

Explanation:

The code that would best accomplish this task using a while loop would be the following:

list1 = [8, 3, 4, 5, 6, 7, 9]

accum = 0

n = 0

while n < 7:

        accum += list1[n]

        n += 1

This code will continue throughout the list1 array and add every value to the accum variable.

5 0
3 years ago
Please write down a java program for below instruction.Min-Heap: Construct a Min_Heap from the following set of integers. Rememb
Leona [35]

Answer:

Following are the program in the Java Programming Language.

//define class

class Heap{

 //set private integer data type array variable

  private int a[];

 //set two private integer data type variables

  private int s,capacity;

 //define private void function for down heap

  private void downheap(int indx) {

    //set if conditional statement

   if(indx>=s)return;

   //set integer type variable and initialize

   int lft=2*indx+1;

   int rgt=2*indx+2;

   int min=indx;

   //set the if-else if conditional statement  

   if(rgt<=s&&a[rgt]<a[indx])

     min=rgt;

   else if(lft<=s&&a[lft]<a[min])

     min=lft;

   //check index is not equal to min    

   if(indx!=min){

     //perform swapping

     int temp=a[indx];

     a[indx]=a[min];

     a[min]=temp;

     downheap(min);

   }  

  }

  //define private void type function for upheap

  private void upheap(int indx) {

      if(indx==0)return;

      int parent=(indx-1)/2;

      if(a[indx]<a[parent]) {

          int temp=a[indx];

          a[indx]=a[parent];

          a[parent]=temp;

          upheap(parent);

      }

  }

 

 public Heap(int q) {

   a=new int [q];

   s=0;

   capacity=q;

 }

 public int _size () {

   return s;

 }

 public int minLookup() {

   if(s>0)return a[0];

   return 0;

 }

 public int remove() {

   int data=a[0];

   a[0]=a[s-1];

   s--;

   downheap(0);

   return data;

 }

 

 public void add (int data) {

   if(s>=capacity)return;

   a[s++] = data;

   upheap(s-1);  

 }

 

 public void print_heap() {

   System.out.print("Heap : ");

   for(int i=0;i<s;i++) {

     System.out.print(a[i]+" ");

   }

   System.out.println();

 }

}

//define class to define main method

public class Main {

 //main method

 public static void main(String srgs[]) {

   //cretae class object

   Heap heap = new Heap(20);

   //call function through object with argument list

   heap.add(1);

   heap.add(19);

   heap.add(7);

   heap.add(5);

   heap.add(6);

   heap.add(42);

   heap.add(21);

   heap.add(13);

   heap.add(56);

   heap.add(78);

   heap.add(29);

   heap.add(3);

   heap.add(14);

   heap.print_heap();

   //print the Output and remove the minimum element

   System.out.println("Minimum element : "+heap.remove());

   heap.print_heap();

   System.out.println("minimum element : "+heap.remove());

   heap.add(45);

   heap.print_heap();

  }

}

<u>Output:</u>

Heap : 1 5 3 13 6 7 21 19 56 78 29 42 14

Minimum element : 1

Heap : 3 5 7 13 6 14 21 19 56 78 29 42

Minimum element : 3

Heap : 7 5 21 13 6 14 42 19 56 78 29 45

Explanation:

Here, we define a class "Heap" inside the class.

  • Set private integer data type array variable.
  • set private two integer data type variables.
  • Then, we define private void type function "downheap()" for down heap and pass an integer data type argument list in its parameter "indx".
  • Then, we define private void type function "upheap()" for upper heap and pass an integer data type argument list in its parameter "indx".
  • Define constructor of the class for the capacity pf the array list.
  • Define void type function "add()" for adding elements in heap.
  • Define void type function "print_heap()" to print the heap.

Finally, we define class to define main function and we create the object of the class "Heap"  then, call all the functions through the class object abd print the output.

4 0
3 years ago
Other questions:
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • What's the best way to change the font size of all your notes pages at once?
    6·1 answer
  • "In about 100 words, describe the idea behind software as a service (SaaS). In your answer, include at least three examples of e
    10·1 answer
  • The basic work area of the computer is it screen that you when you first fire up your computer
    6·1 answer
  • Program documentation _____.
    8·1 answer
  • Why are typewriter keys arranged the way they are?
    14·1 answer
  • In Microsoft Word you can access the _______ command from the "Mini toolbar." 
    9·1 answer
  • (100 points) why does file explorer look like this and how do I fix it? I'm not good with computers, and I kinda need help
    13·1 answer
  • SOMEONE PLEASE HELP ME OUT WITH THIS PLEASE
    13·1 answer
  • Which type of service offers a preconfigured testing environment for application developers to create new software applications?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!