Skip to content

Instantly share code, notes, and snippets.

View anhnguyen1618's full-sized avatar

Ha Anh Nguyen anhnguyen1618

  • Helsinki, Finland
View GitHub Profile
barber() {
customer.acquire()
seat.acquire()
freeSeat ++
seat.release()
cutHair()
barber.release()
}
Semaphore[] forks = {1, 1, 1, 1, 1}
eat(i) {
left= (i + 4) % 5
right = (i + 1) % 5
if (i == 5) {
forks[right].acquire()
forks[left].acquire()
eat()
forks[right].release()
Class Monitor {
string[] states;
cond[] q
pickup() {
states[i] = 'Hungry'
while (check(i) == 'Hungry') {
queue[i].wait()
}
}
readers-writers : monitor;
begin
readercount : integer;
busy : boolean;
OKtoread, OKtowrite : condition;
procedure startread;
begin
if busy then OKtoread.wait;
Semaphore Capacity = N
Semaphore hasItem = 0
Semaphore mutex = 1
Semaphore mutex_out = 1
Producer {
while (True) {
item = produce()
Capacity.acquire()
FROM alpine:3.10
WORKDIR /application
ENV ANDROID_HOME=/usr/local/android
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV SDK_TOOLS_VERSION=sdk-tools-linux-4333796
ENV PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin
ENV ANDROID_SDK_VERSION=26
ENV ANDROID_BUILD_TOOLS_VERSION=26.0.3
openapi: "3.0.0"
info:
version: 1.0.0
title: Task management API
paths:
/task:
post:
summary: Create a task
FROM alpine:3.10
WORKDIR /usr/app
COPY main.sh .
RUN chmod +x ./main.sh
ENV MCCCOURSE=2019
=>>>>>>>>>>>>> end - time Mon Dec 31 15:20:00 EET 2018
{ locationID: 132, revenue: 2308.6106,passenger: 66, trips: 41,start: Mon Dec 31 14:20:00 EET 2018, end: Mon Dec 31 15:20:00 EET 2018 }
{ locationID: 138, revenue: 1518.4502,passenger: 68, trips: 45,start: Mon Dec 31 14:20:00 EET 2018, end: Mon Dec 31 15:20:00 EET 2018 }
{ locationID: 237, revenue: 854.1997,passenger: 118, trips: 75,start: Mon Dec 31 14:20:00 EET 2018, end: Mon Dec 31 15:20:00 EET 2018 }
{ locationID: 236, revenue: 740.7498,passenger: 100, trips: 62,start: Mon Dec 31 14:20:00 EET 2018, end: Mon Dec 31 15:20:00 EET 2018 }
{ locationID: 161, revenue: 708.9797,passenger: 94, trips: 55,start: Mon Dec 31 14:20:00 EET 2018, end: Mon Dec 31 15:20:00 EET 2018 }
{ locationID: 142, revenue: 664.7298,passenger: 91, trips: 58,start: Mon Dec 31 14:20:00 EET 2018, end: Mon Dec 31 15:20:00 EET 2018 }
{ locationID: 239, revenue: 636.2598,passenger: 111, trips: 66,start: Mon Dec 31 14:20:00 EET 2018, end: Mon Dec 31 15:20:00 EET 2018 }
{ locationID: 234,
2019-10-31 20:20:42 : =====================================
2019-10-31 20:20:42 : client-1-broker starting with process id: 5431
2019-10-31 20:21:02 : {"time_avg": 0, "total_size": 406624, "p_id": "5431", "msg_count": 387, "fails_avg": 0, "idle": false}
2019-10-31 20:21:22 : {"time_avg": 0, "total_size": 962064, "p_id": "5431", "msg_count": 917, "fails_avg": 0, "idle": false}
2019-10-31 20:21:42 : {"time_avg": 0, "total_size": 1700904, "p_id": "5431", "msg_count": 1622, "fails_avg": 0, "idle": false}
2019-10-31 20:21:54 : {"time_avg": 17.9269101023674, "total_size": 2097048, "p_id": "5431", "msg_count": 2001, "fails_avg": 0, "idle": false}
2019-10-31 20:21:55 : =====================================
2019-10-31 20:21:55 : client-1-broker starting with process id: 5518
2019-10-31 20:21:55 : =====================================
2019-10-31 20:21:55 : client-1-broker starting with process id: 5499