CS-350 - Fundamentals of Computing Systems Homework #3 - EVALR

Java Python CS-350 - Fundamentals of Computing Systems

Homework Assignment #3 - EVAL

Due on October 3, 2024 — Late deadline: October 5, 2024 EoD at 11:59 pm

EVAL Problem 1

In this EVAL assignment we will understand how seemingly insignificant changes in the input traffic distri-bution can lead to measurable differences in the behavior. of queues and thus in the perceived service.

a) In the previous EVAL assignment, you discovered that the client sends requests to the server with inter-arrival times that are exponentially distributed with mean 1/λ where λ is the arrival rate passed via the parameter -a. Also, the request lengths are exponentially distributed with mean 1/µ where µ is the service rate passed via the parameter -s. Great! But as it turns out, that’s just the default behavior. of the client. Let’s discover what else the client can do.

Which distribution the client uses is controller with an extra parameter -d <dist. number>, where <dist. number> is a number from 0 to 2. When passing -d 0 you will be using the default exponential distribution. But what are the other two distributions? And does the -d <dist.number> parameter control both inter-arrival and service times?

To begin answering these questions, run your server and client with the following parameters (let it run, it will take about 5 minutes):

./server_lim -q 1000 2222 & ./client -a 4.5 -s 5 -n 1500 -d 1 2222

Notice that the client is requested to generate traffic according to distribution 1. Just like you did in HW2, plot the experimental data of inter-arrival times and request lengths and recover the type and parameters of the distributions used by the client when -d 1 is passed.

Hint: there is some guesswork involved in recovering the distribution parameters. Start by looking at the shape of the distribution produced by the collected data and make a guess about which distribution might be. Setting the mean will be easy if you think about it. If there is a standard deviation to set, explore integer fractions or multiples of the mean.

b) Do the same as above to recover the parameters of distribution number 2. In a similar way as above, collect and post-process the server output data generated by the following parameter:

./server_lim -q 1000 2222 & ./client -a 4.5 -s 5 -n 1500 -d 2 2222

When decoding the distributions used by the client and their parameters, make conclusive statements about the distribution type for both inter-arrival times and service lengths, and explicitly state their mean and standard deviation parameters.

c) We are now ready to see how different distributions affect the quality of service in our simple FIFO server. Let us focus on the comparison between an exponential distribution and whatever distribution 1 is. Run and collect experimental data for the following template command:

./server_lim -q 1000 2222 & ./client -a <arr. rate> -s 20 -n 1500 -d 0 2222

where <arr. rate> is varied from (and including) 10 up until 19. Notice that these experiments will ask the client to use an exponential distribution (-d 0). Use this set of experiments to produce a plot of the average response time as a function of the server utilization—in a way similar to what you did in HW1.

Overlap on the same plot produced above the curve obtained by post-processing in the same exact way the results coming from running the following template command:

./server_lim -q 1000 2222 & ./client -a <arr. rate> -s 20 -n 1500 -d 1 2222

where once again <arr. rate> is varied from (and including) 10 up until 19. What can you conclude about the quality service perceived by the user when the load (a.k.a. its utilization) is comparable and only the distribution of the traffic characteristics changes?

d) Let us now explore what happens when the queue has a constrained size. To do that, run the following command:

./server_lim -q 10 2222 & ./client -a 19.6 -s 20 -n 1500 -d 0 2222

Post-process the server output to understand what happened to our requests. First, calculate the ratio of requests that get rejected over the total. Next, plot the distribution of the inter-rejection time, i.e. the time that elapses between a rejection and the next. What does that distribution look like? Do not recover the parameters of the distribution, but simply share your insights on the shape of the distribution.

e) Repeat the same analysis as above, when distribution number 1 is used instead, thus by running the following command:

./server_lim -q 10 2222 & ./client -a 19         

代码中的问题是: 1. 在调用callMethod()方法时,传入的参数类型不匹配,应该将数字1,2,3,4,5修改为1.0,2.0,3.0,4.0,5.0,即将整型转换为浮点型。对于字符串"3",应该将其改为字符'3'。 2. 在调用callMethod()方法时,获取方法的Method对象时,应该使用Double[].class和String[].class而不是Double.class和String.class,因为参数是可变的数组。 修改后的代码如下: ```java package com.enmo.mdi.distributedcomputing.distributed; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Algorithm { public Algorithm() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { } private Double sum(Double... args) { Double num = 0.0; for (Double d: args){ num += d; } return num; } private String add(String... args) { StringBuilder str = new StringBuilder(); for (String s: args){ str.append(s); } return str.toString(); } public static Object callMethod(String name, Object... args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { Class<?> clazz = Class.forName("com.enmo.mdi.distributedcomputing.distributed.Algorithm"); // 获取方法的Method对象 Method method = clazz.getDeclaredMethod(name, Double[].class); method.setAccessible(true); // 调用该方法 return method.invoke(null, (Object) args); } public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { // sum Double result = (Double) callMethod("sum", 1.0, 2.0, 3.0, 4.0, 5.0); System.out.println(result); String result1 = (String) callMethod("add", "1", "2", "3"); System.out.println(result1); } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值