Round robin scheduling - do priorities matter if burst time is long/quantum is short? - scheduling

Not sure if I understood the concept of RR correctly.
Let's say I've got three processes ready to be CPU'd:
A - 1st priority - requires 2 minutes of CPU time;
B - 3rd priority - 5 minutes;
C - 2nd priority - 10 minutes;
So in order to calculate average turnaround time 'on paper', I can presume that quantum=1 minute and process everything according to their priorities (A-C-B, etc).
But one minute is too big for a 'real' quantum, right? Should quantum=10-100 milliseconds, will everything be switched so fast that task order becomes irrelevant? Should I assume that each job will simply consume an equal amount (1/3) of CPU time and go from there? E.g. A will end in 2*3=6 minutes, B will end in (5-2)*2+6=12 minutes and C will end in 10-2-3+12=17 minutes. Thus average tat is (6+12+17)/3=11.66? Or is this just ridiculous?

If processes A, B and C requires execution times as follows,
A - 2 minutes
B - 5 minutes
C - 10 minutes
Then round robin scheduling will give you the following turn around times, If the order of priority is A followed by C followed by B.
A - 4 minutes
B - 12 minutes
C - 17 minutes
The execution of Processes takes place as follows,
Time-> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
A - C - B - A - C - B - C - B - C - B - C - B - C - C - C - C - C
^ ^ ^
| | |
Process A Process B Process C
Completed Completed Completed
Remember order does matter in round robin scheduling because in this case the average turn around time is just (4+12+17)/3=11.

Related

Can you schedule a cron that starts at a specific minute and hour and repeats?

For example, I'd like it to trigger at 6:30, 6:40, 6:50, 7:00, 7:10, 7:20..etc
Is it possible to schedule a cron job that starts at 6:30 every day and runs every 10 minutes until 10:00?
I've tried (30/10 6-10 ? * * * *), but that triggers 6:30, 6:40, 6:50, 7:30, 7:40 and misses the triggers between 7 and 7:30
This is on AWS EventBridge's scheduler.
With 30/10 it will start after 30 mins for every 10 mins. Due to this for every hour it will miss the 0-30 mins window
Why not try 0/10 6-10 ? * * *
Starting 3 - 6.00 6.10 & 6.20 will be extra but it works for other times

Aws Lambda function triggers on a delay time for 2 out of 3 cron jobs

I have a Lambda function that has 3 event triggers here are the Cron job for each:
Cron 1: cron(50/1 22 * * ? *)
Cron 2: cron(50/1 12 * * ? *)
Cron 3: cron(*/15 * * * ? *)
Now Cron 2 Timestamp logs reads as follows, which is ok. Notice that it starts 2-3 seconds into the intended trigger:
10
2021-07-10T05:59:03.867-07:00
11
2021-07-10T05:59:03.867-07:00
12
2021-07-10T05:59:02.314-07:00
START
13
2021-07-10T05:58:02.988-07:00
END
14
2021-07-10T05:58:02.988-07:00
15
2021-07-10T05:58:02.547-07:00
START
BUT Cron 1 & 3 starts over 30+ seconds into the intended trigger. I compared everything possible and there are no settings that are different (to my knowledge). Any idea why 2 of the 3 events have a delay but one doesn't? I understand a small 1-5 second delay by reading here https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html but somethings seems to be off.
2021-07-10T06:30:37.253-07:00
2
2021-07-10T06:30:37.253-07:00
3
2021-07-10T06:30:33.929-07:00
4
2021-07-10T06:15:36.931-07:00
5
2021-07-10T06:15:36.931-07:00
6
2021-07-10T06:15:33.881-07:00
7
2021-07-10T06:00:34.037-07:00
8
2021-07-10T06:00:34.037-07:00
9
2021-07-10T06:00:33.596-07:00
The precision of Event Bridge is one minute:
All scheduled events use UTC+0 time zone, and the minimum precision for a schedule is one minute. Your scheduled rule runs within that minute, but not on the precise 0th second.
So your delays are perfectly fine and within the 1 minute interval.

How to setup Concurrency Thread Group

I have following test plan to test concurrent user load test of a website -
Configuration set as -
Target Concurrency = 10
Ramp up Time = 1
Ramp up step count = 1
Hold Target rate time = 6
So it's creating confusion, what I am expecting that it will send only 10 requests at a time in 1 second but the result is it sends first 10 request at a time in 1 second and continue sending requests till 60 seconds.
Why it is so?
Keep Hold Target Rate Time to 1 sec to match your expectations.
The graph should reflect the settings you made.
Note: In the graph you shared, it is clearly visible that you kept Hold Target Rate Time to 60 sec (reflected in the graph also) which resulted in 60 seconds execution after ramp-up time.
Reference:
Refer Concurrency ThreadGroup section in the link
as per requirements for simulating 10 requests at a time in 1 second
Target Concurrency = 10
Ramp up Time = 1
Ramp up step count = 1
Hold Target rate time = 1
Keep Hold Target rate time till you want to run to test.
e.g 1 sec for running test plan for 1 sec, 1 min to run test plan for 1 min.

Reading value after every 1 seconds

I have two raspberry pi. Suppose this two pi are denoted as A and B
So A and B are connected with each other over socket.
On particular event, A is generating value every one seconds.
and on event A stops generating those values.
So B needs to read those values from A every 1 second over socket.
So B has while loop running
So what I have done is that I am reading time every while loop iteration and checking whether 1 seconds elapsed or not. If 1 seconds elapsed, I am reading values from B.
Here is some pseudo code for this.
while True:
on = read_from_A()
if on: // "on" will suggest me to start read from B
current_time = time.time()
if current_time - last_time == 1:
read_values_from_A()
last_time = current_time
do_some_task()
With this approach I am not able to read read values from A exact after 1 seconds. B is missing some values from A.
So suppose A generated 360 values in 6 minutes
B should be able to read those 360 values.
What is the way that I should be using so that there should not be any data loss.

SoapUI load test, calculate cnt in variance strategy

I work with SoapUI project and I have one question. In following example I've got 505 requests in 5 seconds with thread count =5. I would like to understand how count has been calculated in this example.
For example, if I want 1000 request in 1 minute what setting should I set in variance strategy?
Regards, Evgeniy
variance strategy as the name implies, it varies the number of threads overtime.Within the specified interval the threads will increase and decrease as per the variance value, thus simulating a realistic real time load on target web-service.
How variance is calculated : its not calculated using the mathematical variance formula. its just a multiplication. (if threads = 10 and variance = 0.5 then 10 * 0.5 = 5. The threads will be incremented and decremented by 5)
For example:
Threads = 20
variance = 0.8
Strategy = variance
interval = 60
limit = 60 seconds
the above will vary the thread by 16 (because 20 * 0.8 = 16), that is the thread count will increase to 36 and decrease to 4 and end with the original 20 within the 60 seconds.
if your requirement is to start with 500 threads and hit 1000 set your variance to 2 and so on.
refrence link:
chek the third bullet - simulating different type of load - soapUI site
Book for reference:
Web Service Testing with SoapUi by Charitha kankanamge