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
Nataliya [291]
3 years ago
14

5.20 Which of the following scheduling algorithms could result in starvation? a. First-come, first-served b. Shortest job first

c. Round robin d. Priority
Computers and Technology
2 answers:
fomenos3 years ago
6 0

Answer:

b. Shortest job first and d. Priority

Explanation:

First let us understand what starvation is. Starvation is basically situation in which a process does not get required resources because other processes are being allocated to these resources and are utilizing those resources. So that process is in starvation as it does not get access to the resource and it is unable to execute.

In the First-come first-served scheduling algorithm the processes are executed in the order or sequence such that the first process is executed first and the second process is executed after the first process finishes its execution. So in this scheduling algorithm no starvation can occur as there is no process which will never get a resource and will never be able to execute.

Shortest job first chooses out of the waiting processes, the process which has the shortest execution time to be executed first. This results in the processes with long execution time to wait for their execution. This wait can go till infinity and the waiting long processes might never get the resources for their execution if the shorter processes keep arriving. So this can result in starvation.

Round robin algorithm gives each process a fixed time slot called quantum time for its execution.  So no process will have to wait for long and wait for a resource to be allocated for long in order to be executed. So this is a starvation free scheduling algorithm.

In priority scheduling the processes are given priorities to execute which means that the process with high priority will be allocated the resource and will be executed first.  This causes the low priority processes to wait for long and this waiting can go to infinity and the low priority process might not be able to get a resource for their execution. So this scheduling algorithm could result in starvation.

NARA [144]3 years ago
5 0

Answer: (b) and (d)

Explanation:

Shortest job first and Priority are scheduling algorithms that could result in starvation.

The others won't result in starvation

You might be interested in
This project involves writing a program that encodes and decodes messages. The program should prompt the user to select whether
Lilit [14]

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class EncodeDecodeMessage {

public static String encode(String str) {

String result = "";

char ch;

for(int i = 0; i < str.length(); ++i) {

ch = str.charAt(i);

if(Character.isLowerCase(ch)) {

result += (char)('a' + (25-ch+'a'));

} else if(Character.isUpperCase(ch)) {

result += (char)('A' + (25-ch+'A'));

} else {

result += ch;

}

}

return result;

}

public static String decode(String str) {

return encode(str); // since the scheme is same, we can use encode for decode

}

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.print("1. Encode, 2. Decode. Enter your choice: ");

int choice = in.nextInt();

in.nextLine();

if(choice == 1) {

System.out.print("Enter sentence to encode: ");

String line = in.nextLine();

System.out.println("Encoded string is: " + encode(line));

} else if(choice == 2) {

System.out.print("Enter sentence to decode: ");

String line = in.nextLine();

System.out.println("Decoded string is: " + decode(line));

}

}

}

8 0
3 years ago
CHANGE POSITION OF SONG Enter song's current position: Enter new position for song: "Peg" moved to position 3 JAMZ PLAYLIST MENU
hichkok12 [17]

Answer:

Answers can be found below

Explanation:

port java.util.Scanner;

public class Playlist {

String title;

SongEntry head;

public Playlist(String title) {

this.title = title;

this.head = null;

}

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.println("Enter the playlist's title:");

String title = scanner.nextLine();

Playlist playList = new Playlist(title);

String option;

do {

option = playList.printMenu(scanner);

switch (option) {

case "a":

playList.addSong(scanner);

break;

case "d":

playList.removeSong(scanner);

break;

case "c":

playList.changePosition(scanner);

break;

case "s":

playList.outputSongByArtist(scanner);

break;

case "t":

playList.outpuTotalTime();

break;

case "o":

playList.outputFullPlayList();

break;

case "q":

System.out.println("QUIT");

break;

default:

System.out.println("please enter a valid option");

}

} while (!option.equals("q"));

}

public String printMenu(Scanner scanner) {

System.out.println(this.title + " PLAYLIST MENU");

System.out.println("a - Add song");

System.out.println("d - Remove song");

System.out.println("c - Change position of song");

System.out.println("s - Output songs by specific artist");

System.out.println("t - Output total time of playlist (in seconds)");

System.out.println("o - Output full playlist");

System.out.println("q - Quit");

System.out.println("Choose an option:");

String input = scanner.nextLine();

return input;

}

public void outputFullPlayList() {

if (head == null) {

System.out.println("Playlist is empty");

} else {

SongEntry tempNode = head;

while (tempNode != null) {

tempNode.printPlaylistSongs();

tempNode = tempNode.getNextNode();

}

}

}

public void addSong(Scanner scanner) {

System.out.println("ADD SONG");

System.out.println("Enter song's unique ID:");

String uniqueId = scanner.nextLine();

System.out.println("Enter song's name:");

String songName = scanner.nextLine();

System.out.println("Enter artist's name:");

String artistName = scanner.nextLine();

System.out.println("Enter song's length (in seconds):");

int length = Integer.parseInt(scanner.nextLine());

SongEntry song = new SongEntry(uniqueId, songName, artistName, length);

if (head == null) {

head = song;

} else {

SongEntry tempNode = head;

while (tempNode.getNextNode() != null) {

tempNode = tempNode.getNextNode();

}

tempNode.insertAfter(song);

}

}

public void removeSong(Scanner scanner) {

System.out.println("REMOVE SONG");

System.out.println("Enter song's unique ID:");

String uniqueId = scanner.nextLine();

SongEntry tempNode1 = head;

SongEntry tempNode2 = head;

while (tempNode1 != null) {

if (tempNode1.getUniqueID().equals(uniqueId)) {

if (tempNode1.getUniqueID().equals(head.getUniqueID())) {

6 0
3 years ago
In which of the following situations may the taxpayer take an education expense on Schedule C? a. Henry, a self-employed adminis
daser333 [38]

Answer:

Henry, an administrative assistant, is taking an advanced Word computer program class through an adult school program.  

Explanation:

4 0
3 years ago
A list of sources used for in-text citations that appears at the end of a document is called:
jolli1 [7]
The correct answer is Works cited page
5 0
2 years ago
Which US electronics company was the pioneer in home video game consoles
drek231 [11]

This is a list of home video game consoles in chronological order, which includes the very first home video game consoles ever created, such as first generation Pong consoles, from the first ever cartridge console Odyssey, ranging from the major video game companies such as Magnavox, Atari, Nintendo, Sega, NEC, 3DO, SNK, Sony, Microsoft to secondary market consoles.


The list is divided into eras which are named based on the dominant console type of the era, though not all consoles of those eras are of the same type. Some eras are referred to based on how many bits a major console could process. The "128-bit era" (sixth generation) was the final era in which this practice was widespread.[citation needed]


This list does not include other types of video game consoles such as handheld game consoles, which are usually of lower computational power than home consoles due to their smaller size, microconsoles, which are usually low-cost Android-based devices that rely on downloading, or dedicated consoles which have games built in and do not use any form of physical media. Consoles have been redesigned from time to time to improve their market appeal. Redesigned models are not listed on their own.

7 0
3 years ago
Other questions:
  • Which Command Prompt commands in Windows is used for listing a computer connections to shared resources
    10·1 answer
  • Ned and mary ann are saving their files to a cd
    15·1 answer
  • What is ment by creative middle way solution
    6·1 answer
  • This program has some errors in it that are needed to be checked import java.io.*;
    13·1 answer
  • It chapter 2 pennywise
    13·1 answer
  • Define stubs for the functions called by the below main(). Each stub should print "FIXME: Finish FunctionName()" followed by a n
    7·1 answer
  • நெறி என்னும் சொல்லின் பொருள்___ *​
    14·1 answer
  • What is the diffrent between ibm pc and ibm compatibles in table:​
    11·1 answer
  • What are the different Stape of data processing cycle?​
    8·1 answer
  • what is the arrangement of various flash elements, such as the tools panel, control panel, property inspector and stage
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!