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
Len [333]
3 years ago
9

Considering the following algorithm, which of the following requirements are satisfied?

Computers and Technology
1 answer:
Alisiya [41]3 years ago
4 0

Answer:

b) Bounded Waiting

Explanation:

int currentThread = 1;

bool thread1Access = true;

bool thread2Access = true;

thread1 { thread2 {

While (true) {

                   While (true)

                                   {

                     while(thread2Access == true)

                                       {

                                      while(thread1Access == true)

                                       {

                                            If (currentThread == 2) {

                                              If (currentThread == 1)

                                                {        

                                                  thread1Access = false; thread2Access = false;

                                                  While (currentThread == 2);

                                                 While (currentThread == 1);

                                                  thread1Access = true; thread2Access = true;

} }

/* start of critical section */ /* start of critical section */

currentThread = 2 currentThread = 1

… ...

/* end of critical section */ /* end of critical section */

thread1Access = false; thread2Access = false;

… ...

} }

} }

} }

It can be seen that in all the instances, both threads are programmed to share same resource at the same time, and hence this is the bounded waiting. For Mutual exclusion, two threads cannot share one resource at one time. They must share simultaneously. Also there should be no deadlock. For Progress each thread should have exclusive access to all the resources. Thus its definitely the not the Progress. And hence its Bounded waiting.

You might be interested in
#A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every
lara [203]

Answer:

To check if the year comes under each 100th year, lets check if the remainder when dividing with 100 is 0 or not.

Similarly check for 400th year and multiple 0f 4. The following C program describes the function.

#include<stdio.h>

#include<stdbool.h>

bool is_leap_year(int year);

void main()

{

int y;

bool b;

 

printf("Enter the year in yyyy format: e.g. 1999 \n");

scanf("%d", &y);     // taking the input year in yyyy format.

 

b= is_leap_year(y);  //calling the function and returning the output to b

if(b==true)

{

 printf("Thae given year is a leap year \n");

}

else

{

 printf("The given year is not a leap year \n");

}

}

bool is_leap_year(int year)

{

if(year%100==0)   //every 100th year

{

 if(year%400==0)   //every 400th year

 {

  return true;

 }

 else

 {

  return false;

 }

}

if(year%4==0)  //is a multiple of 4

{

 return true;

}

else

{

 return false;

}

}

Explanation:

Output is given as image

5 0
3 years ago
Why should information technology NOT be taught in school?​
tatiyna

Explanation:

Technology should not be used to teach in school as it can lead to distractions. With kids wanting to explore other sights, cheating, and communicating with others. Also, it can be expensive to purchase the technology for everyone as it can be a major investment with hundreds or thousands going into it. Technology also requires a lot of training by having to adapt lessons compatible with the systems and making sure the software is secure.

5 0
3 years ago
Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than
Gnoma [55]

Answer:

public static void print_popcorn_time(int bag_ounces){

       if(bag_ounces<3){

           System.out.println("Too Small");

       }

       else if(bag_ounces>10){

           System.out.println("Too Large");

       }

       else{

           bag_ounces*=6;

           System.out.println(bag_ounces+" seconds");

       }

   }

Explanation:

Using Java prograamming Language.

The Method (function) print_popcorn_time is defined to accept a single parameter of type int

Using if...else if ....else statements it prints the expected output given in the question

A complete java program calling the method is given below

public class num6 {

   public static void main(String[] args) {

       int bagOunces = 7;

       print_popcorn_time(bagOunces);

   }

   public static void print_popcorn_time(int bag_ounces){

       if(bag_ounces<3){

           System.out.println("Too Small");

       }

       else if(bag_ounces>10){

           System.out.println("Too Large");

       }

       else{

           bag_ounces*=6;

           System.out.println(bag_ounces+" seconds");

       }

   }

}

3 0
3 years ago
If you want to copy data from one cel to another cell that is several rows down in a worksheet, which method should you use?
bogdanovich [222]

copy and paste

so you can keep the data in the current cell and add it to other cells that you want that data in as well

5 0
3 years ago
What allows a programmer to write code quickly and efficiently for an action that must be repeated?
Marta_Voda [28]
An literation :))!! i hope u get it right lol
6 0
2 years ago
Read 2 more answers
Other questions:
  • What are three requirements of information technology a. Accuracyb. _______________________________c. __________________________
    13·1 answer
  • What Word feature is seen below?
    10·1 answer
  • Which port must be open on your router to allow you to upload device configuration and firmware updates using trivial file trans
    13·1 answer
  • Write a CPP Program to read an integer number. Use a pointer to display this numbe
    5·1 answer
  • Type the correct answer in each box. Spell all words correctly.
    14·2 answers
  • How do you change the order of the slides in your presentation in the slide pane 
    15·2 answers
  • An algorithm is:
    14·1 answer
  • Which of the following is ture?
    11·1 answer
  • Please help me please please
    14·2 answers
  • What does a companys code of ehtics cover
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!