This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Consider a system running ten I/O-bound tasks and one CPU-bound task. | |
# Assume that the I/O-bound tasks issue an I/O operation once for every millisecond of CPU computing and that each I/O operation takes 10 milliseconds to complete; the CPU-bound task performs only computations. | |
# Also assume that the context-switching overhead is 0.1 milli-second and that all processes are long-running tasks. | |
# | |
# Find out the CPU utilization for a round-robin scheduler when: | |
# | |
# a. The time quantum is 1 millisecond | |
# | |
# b. The time quantum is 10 milliseconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
import java.util.*; | |
import java.util.concurrent.*; | |
/** | |
* Creates a histogram of ASCII character counts for text files. | |
*/ | |
public class Histogram | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
import java.util.*; | |
import java.util.concurrent.*; | |
/** | |
* Creates a histogram of ASCII character counts for text files. | |
*/ | |
public class Histogram | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.concurrent.*; | |
/** | |
* Creates a histogram of ASCII character counts for text files. | |
*/ | |
public class Histogram | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. (70pts) Develop a monitor in C (using pthread library functions) or Java to solve the producer-consumer problem. [Hint: your program can be cased on the pseudo-code on Page 7 of 2013-3-4's lecture] | |
#include <pthread.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <semaphore.h> | |
#define CAN_CONSUME_PATH "/tmp/canConsume" | |
#define CAN_PRODUCE_PATH "/tmp/canProduce" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Brian Anderson, Spring 2013 | |
* Com S 352, Assignment 7 | |
* | |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
* INTRODUCTION & PURPOSE | |
* ------------------------------------------------------------------- | |
* Create a monitor library fashioned after the slides shown in class. | |
* It solves the producer/consumer problem by making sure their | |
* execution happens in a safe manner, even across multiple threads |

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import async.IAsyncCalculator; | |
import async.ICallback; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.ObjectInputStream; | |
import java.io.ObjectOutputStream; | |
import java.net.Socket; | |
import java.util.HashMap; | |
import java.util.Map; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Brian Anderson, Com S 352 Project 1 | |
* UThread a User Thread Library, it uses only 1 "kernel thread" | |
*/ | |
#ifdef __APPLE__ | |
#define _XOPEN_SOURCE /* See note at the bottom about this */ | |
#endifult_activeContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Brian Anderson | |
ComS 352, Assignment 8 | |
March, 28th, 2013 | |
------------------------------------------------------------------------------- | |
1.A. Deadlock happens between the P1 and P2 during the following sequence. | |
P1 locks s1, 1.1 | |
(p1 access x) 1.2 | |
p2 locks s2 2.1 | |
(p2 access y) 2.2 |
OlderNewer