answer.
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
Gnesinka [82]
2 years ago
12

A semaphore puts a thread to sleep:

Computers and Technology
1 answer:
otez555 [7]2 years ago
3 0

Answer:

B. until another thread issues a notify on the semaphore.

Explanation:

A semaphore is a variable that is shared between threads and is not negative. It also acts as a calling mechanism that uses two atomic operations wait and signal for synchronization of processes.

A thread that is waiting for a process can be signaled by another thread.

A semaphore puts a thread to sleep until another thread issues a notify on the semaphore.

The wait operation will get a semaphore or otherwise wait if the busy S semaphore is available.

The signal operation will release a semaphore or wake a process if there is a thread waiting for S.

You might be interested in
What is the value of x after each of the following statements is encountered in a computer program, if x=1 before the statement
steposvetlana [31]

Answer:

x=2

x=1

x=2

Explanation:

a)

This if statement if (1+2=3) checks if the addition of two numbers 1 and 2 is true. Here the addition of 1 and 2 is 3 which is true. So the condition becomes true.

Since the condition is true x:=x+1 statement is executed. This statement means that the value of x is incremented by 1.

The value of x was 1 before the if statement is reached. So x:=x+1 statement will add 1 to that value of x.

x:=x+1 means x=x+1 which is x=1+1 So x=2

Hence value of x is 2 (x=2) after the execution of x:=x+1

b)

In statement b the value of x will be 1 because both the mathematical operations in the if statement evaluate to false.

which means in b, x:=x+1 will not be executed and value of x remains unchanged i.e x=1

In (c) the value x will be 2 because the condition in the if statement is true. Both mathematical expressions 2+3=5 and 3+4=7 are true. Therefore x:=x+1 will be executed and value of x will be incremented by 1. Hence x=2

5 0
2 years ago
Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the n
mote1985 [20]

Answer:

import java.util.Scanner;

public class VowelsAndConsonantsDemo {

   /**

   The printMenu methods displays a menu to the user

    */

   public static void printMenu() {

       System.out.println("Please select an option: ");

       System.out.println();

       System.out.print("a. Count the number of vowels in the string.\n"

               + "b. Count the number of consonants in the string.\n"

               + "c. Count both the vowels and consonants in the string.\n"

               + "d. Enter another string.\n"

               + "e. Exit the program\n");

   }

   public static void main(String[] args) {

       String input;      // to hold the user's input

       String option;     // to hold the user's input

       char choice;       // to hold a single character

       char exit;         // user chooses 'e' to exit the program

       char letter;       //the Y or N from the user's decision to exit

       // create a Scanner object to read keyboard input.

       //  Scanner keyboard = new Scanner(System.in);

       Scanner keyboard;

       do {

           keyboard = new Scanner(System.in);

           // ask user to enter string

           System.out.print("Enter a string: ");

           input = keyboard.nextLine();

           input = input.toLowerCase();

           System.out.println();

           printMenu();

           option = keyboard.nextLine();

           choice = option.charAt(0);

           VowelsAndConsonants words = new VowelsAndConsonants(input);

           switch (choice) {

               case 'a':

               case 'A':

                   System.out.println("Number of Vowels: " + words.getVowels());

                   break;

               case 'b':

               case 'B':

                   System.out.println("Number of Consonants: " + words.getConsonants());

                   break;

               case 'c':

               case 'C':

                   System.out.println("Number of Vowels & Consonants: " + words.getConsonants()

                           + words.getVowels());

                   break;

               case 'd':

               case 'D':

                   System.out.println("Enter a string: ");

                   break;

               case 'e':

               case 'E':

                   System.exit(0);

                   break;

               default:

                   System.out.println("You did not enter a valid choice.");

           }

           //

           // keyboard.nextLine();    //consumes the new line character after the choice

           // String answer = keyboard.nextLine();

           // letter = answer.charAt(0);

       } while (true);

   }

}

4 0
2 years ago
Ben is writing web page content on a newly launched gaming gadget. He has to use hyperlinks to help visitors navigate to web pag
GarryVolchara [31]

Answer: A. at the bottom of the web page

Explanation:

3 0
2 years ago
What level of fault is the following example: North Lake Hospital followed all of the HIPAA policies and procedures for securing
kotegsom [21]

Answer:

The level of fault for the example given is Level three (3)

Explanation:

Basic information to know about HIPAA include:

  1. <em>HIPAA</em> stands for <em>Health Insurance Portability and Accountability Act.</em>
  2. Its security rules cover technical, physical and administrative areas.
  3. There are four (4) levels of fault.

3 0
2 years ago
Read 2 more answers
A developer writes a trigger on the Account object on the before update event that increments a count field. A workflow rule als
Andreyy89

Answer:

The answer is "2"

Explanation:

In the given question, the answer is "2" because if the user is new. so very first, the user creates its account and after creating his account, he will update his account value.

When the user creates its account, the value will be 1, and when he updates its account value. so, the value will be 2, that's why 2 is the correct answer.

4 0
2 years ago
Other questions:
  • What critical issue in symmetric and asymmetric encryption is resolved by using a hybrid method like diffie-hellman?
    5·2 answers
  • A new company starts up but does not have a lot of revenue for the first year. Installing anti-virus software for all the compan
    11·1 answer
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 the output is
    5·1 answer
  • Int side1;
    5·1 answer
  • FTP requires confirmation that a file was successfully transmitted to a client, but it has no built-in mechanism to track this i
    5·1 answer
  • Given an alphabet, print all the alphabets up to and including the given alphabet.
    15·2 answers
  • A few of your employees have complained that their computers sometimes shut down spontaneously. You have noticed that these empl
    6·1 answer
  • Remember that it is desirable for good block ciphers that a change in one input bit affects many output bits, a property that is
    9·1 answer
  • Look at the following array definition:
    11·1 answer
  • A major clothing retailer has requested help enhancing their online customer experience. How can Accenture apply Artificial Inte
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!