Free Essay

Round Robin

In:

Submitted By CA13020
Words 486
Pages 2
LAB 8
Task 1

Dfnalskfj;aslja;sf
Asfasfasfasf
Asfasf
Asfasf
Asfasff
Gjfgjfgdhjd
Dgdrd

Task 2

#include<stdio.h>
//#include<conio.h>

main(){

int i, j, k, n, so, tq, sob, sum, swt, stat, tata, temp, count; int bt[10], bth[10], wt[10], tat[10]; float awt=0.0, atat=0.0; char new;

printf("\n\n\n\n To start round robin scheduling press any key: ");

k = 0; new = getchar(); system("cls");

while(k < 7){

j = 0; sob = 0; count = 0; sum = 0; swt = 0; stat = 0; tata = 0;

printf("\n\n\n\t\t\t ROUND-ROBIN SCHEDULING"); printf("\n\t\t\t ======================"); printf("\n\n\n\n\n Enter number of processes: "); scanf("%d", &n); printf("\n");

for(i = 0; i < n; i++){

printf("\n Enter burst time for Process P%d: ", i+1); scanf("%d", &bt[i]); bth[i] = bt[i]; }

printf("\n\n Enter time quantum: "); scanf("%d", &tq); system("cls"); printf("\n\n\n\t\t\t ROUND-ROBIN SCHEDULING"); printf("\n\t\t\t ======================"); printf("\n\n\n\n\n Time quantum: %d", tq);

for(i = 0; i < n; i++){

if(bth[i] % tq == 0){

so = bth[i] / tq; } else{so = (bth[i] / tq) +1;} sob = sob + so; }

int gc[sob], gcps[sob];

while(1){

for(i = 0,count = 0; i < n; i++){

temp = tq; if(bth[i] == 0){

count++; continue; }

if(bth[i] > tq){

gc[j] = tq; gcps[j] = i+1; j++; bth[i] = bth[i] - tq; }

else if(bth[i] >= 0){

if(bth[i] == tq){gc[j] = tq; gcps[j] = i+1; j++;} else{gc[j] = bth[i]; gcps[j] = i+1; j++;} temp = bth[i]; bth[i] = 0; }

tata = tata + temp; tat[i ]= tata; }

if(n==count){

break; } }

for(i = 0; i < n; i++){

wt[i] = tat[i] - bt[i]; swt = swt + wt[i]; stat = stat + tat[i]; }

awt = (float)swt/n; atat = (float)stat/n;

printf("\n\n Process Burst time tot.timetaken tot.serve time\n"); printf(" ------- ---------- ------------ ----------------\n");

for(i = 0; i < n; i++){

printf("\n\n P%d\t %d\t %d \t %d", i+1, bt[i], wt[i], tat[i]); }

printf("\n\n\n\n Gantt Chart:\n"); printf(" ------------\n\n"); for(j = 0; j < sob; j++){

printf("\tP%d", gcps[j]); } printf("\n 0"); for(j = 0; j < sob; j++){

sum = sum + gc[j]; if(j == 0){printf(" %d", sum);} else{printf("\t %d", sum);} } printf("\n\n\n\n Average waiting time: %.2f \n\n Average turn around time: %.2f",awt,atat); printf("\n\n\n\n To start again press S and to exit press any key: ");

new = getchar(); system("cls");

if(new == 'S'|| new == 's'){k++;} else{printf("\n\n\n Program was terminated successfully\n\n Thank you\n\n\n"); break;}

}
}

Asfasfjavsfjafa

Asfd
As
Fa
Sf
asf

dasjdaskjhfaksjf

Similar Documents

Free Essay

The Little Prince

...first prize in the event. This does not always mean that the defeated competitor will not participate further in the tournament; in some such tournaments, consolation or "classification" contests are subsequently held among those already defeated to determine the awarding of lesser places, for example, a third place playoff. Where more than two competitors can play in each match, such as in a shootout poker tournament, players are removed when they can no longer play until one player remains from the group. This player moves on to the next round. A simple way to describe a single-elimination tournament is that the winner of each match moves on and the loser fails to progress in the tournament. Some advantages of single elimination tournaments are: * the participants understand them easily * they are the simplest tournaments to conduct * they are useful in determining a champion for preliminary tournaments, such as a round robin * they determine the champion in the shortest time compared with other tournaments * they can be conducted with limited facilities * they can accommodate a large number of entries * they are interesting for spectators * they are the most appropriate for a one-day event * they are economical to conduct Some disadvantages of single elimination tournaments are: * they involve minimum participation * they place maximum emphasis on winning * the champion may not represent the best team or player...this also applies...

Words: 3291 - Pages: 14

Free Essay

Obesity

...Running head: RESEARCH CRITIQUE Research Critique of “Physical Education Teaching Methods” Jerome T. Gardner Columbia Southern University March 2011 Research Critique of “Physical Education Teaching Methods” Introduction The introduction of this article does give you a sense of importance of the problem in physical education. The area being talked about in this article is An instructional model is a "plan or pattern that can be used to shape curriculums (long-term courses of studies), to design instructional materials, and to guide instruction in the classroom or other settings" (Joyce & Weil, 1980, p. 1). The authors then go on about to say improvement in physical education to be an educational outcome and do not see the need to include additional outcomes. The absolute priority clearly requires applicants to propose projects that address physical education. More specifically, the absolute priority requires every applicant to develop, expand, or improve its physical education program and address its State's physical education standards. Statement of the problem The purpose of this study “is to analyze and evaluate and give insightful, critical, and logical to the points the authors made”. While the authors do list a purpose for the study they do not have a well-defined problem statement. They do say that a message from the school district, but they do not say how it would be beneficial. Review of Literature The literature review that was done by the authors...

Words: 1278 - Pages: 6

Free Essay

Srm 320 Week 1 Quiz

... Procedures can be more accurately evaluated if educators possess management understanding  The life of the educator is directly affected by management 4.         The interscholastic or intercollegiate sport program in theory should be financed by: Gate receipts Special projects Student Fees Donations Board of education or central college funds  5.        The type of tournament in which each team plays every other team at least once is known as: Round robin Elimination Pyramid Bagnall-Wild Single elimination 6.         Incorrect management procedures are likely to result in: Increased production Better human relations High staff morale Loss of efficiency None of the choices are correct 7.        One of the most frequent causes of game protests is: Use of officials without ratings Poor sportsmanship of spectators Use of ineligible players Failure to pay agreed fees Dishonesty of officials 8.        The tournament that is the most economical from the standpoint of time is the: Double elimination Ladder Round robin Pyramid Single...

Words: 352 - Pages: 2

Free Essay

Optimal Power Allocation and Scheduling for Two-Cell Capacity Maximization

...Optimal Power Allocation and Scheduling for Two-Cell Capacity Maximization ∗ Dept. Anders Gjendemsjø∗, David Gesbert†, Geir E. Øien∗ , and Saad G. Kiani† of Electronics and Telecom., Norwegian Univ. of Science and Technology, 7491 Trondheim, Norway, Email: {gjendems, oien}@iet.ntnu.no † Mobile Communications Department, Institute Eur´ com, e 06560 Sophia-Antipolis, France, Email: {gesbert, kiani}@eurecom.fr maximize the network capacity for the case of individual link power constraints [8] and a sum power constraint [9]. In [10] it is assumed that each base station, when it transmits, transmits with maximum power Pmax . Which base stations that should be active at each time slot is decided according to a rate maximization objective. However, no proof of optimality is given for the on/off power allocation. In [11] transmit power allocation for a downlink two-user interference channel is studied under a sum transmit power constraint and the assumption of symmetric interference. The derived power allocation depends on the level of interference; when the inference is above a certain threshold the total power is allocated to the best user. For interference less than the threshold, the available power is divided among the two users according to a water-filling principle. However, due to the sum power constraint and symmetry of interference assumption these results are not readily applicable for two-cell power allocation, where it is more reasonable to assume individual power constraints...

Words: 4991 - Pages: 20

Free Essay

Joint Admission Control and Resource Allocation

...IEEE Globecom 2010 Workshop on Broadband Wireless Access Joint Admission Control and Resource Allocation with GoS and QoS in LTE Uplink Oscar Delgado ECE, Concordia University Montreal, Qc, H3G 1M8, Canada Email: o delgad@encs.concordia.ca Brigitte Jaumard CIISE, Concordia University Montreal, Qc, H3G 1M8, Canada Email: bjaumard@ciise.concordia.ca Abstract—In this paper, an admission control (AC) scheme is proposed for handling multiclass Grade of Service (GoS) and Quality of Service (QoS) in Uplink Long Term Evolution (LTE) systems. GoS requirement in conjunction with QoS has been seldom taken into account in previous admission control and resource allocation algorithms for LTE uplink. We propose a novel algorithm for handling the priorities while fulfilling the QoS objective of all granted requests. It corresponds to a solution that combines resource allocation and admission control properties to satisfy the GoS and QoS objectives. Call blocking probability, call outage probability, system capacity and number of effectively served requests are used as performance metrics. Numerical results show that it is possible to manage a priority scheme which satisfies the QoS constraints of all granted requests without any system capacity loss, when comparing to previous algorithms. Furthermore, the proposed AC algorithm gain, for the most sensitive traffic, can be around 20% over the reference AC algorithm. Index Terms—QoS, Priority, Admission Control, Scheduling, LTE, Uplink...

Words: 3728 - Pages: 15

Free Essay

Operation Management

...Backward Scheduling – An effective way of scheduling Warehouse activities Traditionally, scheduling algorithms were used in capital intensive production processes where there was a need to optimize the production because the plant capacity was constrained and there were different lines of products vying for the same manufacturing plant resources. With warehouse operations getting more complex and automated over the years, a similar need is felt to schedule some of the warehouse jobs using these algorithms to optimize the use of resources such as cranes, conveyors, labelers and pickers deployed in the warehouse to maximize the throughput. This paper describes the approach of one of the scheduling a l g o r i t h m s c a l l e d “ B a c k w a r d S c h e d u l i n g”, i t s implementation in scheduling picking operations in Warehouse and the advantages realized by using this approach Backward Scheduling – An effective way of scheduling Warehouse activities About the Author Tarun Chugh He is an IT specialist with Tata Consultancy Services for the last 8 years and has an overall experience of over 10 years. His technological forte has been IBM iSeries (AS/400) based technologies. He has extensive experience in architecting solutions in different domains such as Banking, Retail, Insurance and Manufacturing. He is currently working on a project which involves design and development of processes for automation of warehouse operations of a US based Fortune 500 retail organization...

Words: 4735 - Pages: 19

Premium Essay

A Distributed Joint Channel-Assignment, Scheduling and Routing Algorithm for Multi-Channel Ad Hoc Wireless Networks

...A Distributed Joint Channel-Assignment, Scheduling and Routing Algorithm for Multi-Channel Ad Hoc Wireless Networks Xiaojun Lin and Shahzada Rasool School of Electrical and Computer Engineering, Purdue University West Lafayette, IN 47907, U.S.A. {linx,srasool}@ecn.purdue.edu Abstract— The capacity of ad hoc wireless networks can be substantially increased by equipping each network node with multiple radio interfaces that can operate on multiple non-overlapping channels. However, new scheduling, channelassignment, and routing algorithms are required to fully utilize the increased bandwidth in multi-channel multi-radio ad hoc networks. In this paper, we develop a fully distributed algorithm that jointly solves the channel-assignment, scheduling and routing problem. Our algorithm is an online algorithm, i.e., it does not require prior information on the offered load to the network, and can adapt automatically to the changes in the network topology and offered load. We show that our algorithm is provably efficient. That is, even compared with the optimal centralized and offline algorithm, our proposed distributed algorithm can achieve a provable fraction of the maximum system capacity. Further, the achievable fraction that we can guarantee is larger than that of some other comparable algorithms in the literature. I. I NTRODUCTION Multi-channel multi-radio ad hoc wireless networks have recently received a substantial amount of interest, especially under...

Words: 8961 - Pages: 36

Free Essay

Robin Hood

...Robin Hood’s initial gripe was rooted in a personal conflict he had experienced with the Sherriff and his administration. He wanted revenge. Realizing the numbers were not on his side he mustered his leadership skills and banded together a group of men. Their strategy was to rob the rich and give to the poor. He was the leader and he had five lieutenants to help him lead. The fame of the band led to sharp increase in volunteers to the cause. Admittance measures were lax and there became were too many people to train and feed. Just like any small company that expands far too quickly-they were in danger of overexerting their resources. The bargaining power of suppliers was very high because Robin Hood and his men were thieves and by associating with them they themselves could get in trouble as well. Even though they were gaining in the numbers they were getting weaker and were more vulnerable to threats of attacks by their competitive rivals the Sheriff and Prince John. Robin suggested taxing the men but his lieutenants pointed out that the low threat from buyers was maintained by the fact that they were not taxed. I recommend that they start to screen who they admit into the group. The group has very obvious needs like for farmers and hunters who can supply food for them. At this time they should recruit people with these skill sets. Robin also needs to delegate more people to work with the initial five lieutenants so that their knowledge can be passed on to all the new recruits...

Words: 280 - Pages: 2

Premium Essay

He Said-She Said

...when this happens, constructive conflict becomes very difficult according to Wilmot and Hocker. Every time the issue of her son defying the rules and doing as he pleases comes up, Marie and Mike will have to reach some type of an agreement on the “avoidance/engagement”, or this metaconflict will override any other emerging issues (Wilmot & Hocker)”. Marie uses avoidance to sidestep the issue by withdrawing from the issue and destructive competition through personal criticism when she tells Mike; “Real punishment? How would you know? You never had children. What do you know about being a parent? You never even call your own mother.” (Case Study) This competitive tactic can often damage a relationship. It “locks the participants into round-robin sequences of attack on each other, and deprives the participants of cooperative solutions to their problems (Wilmot & Hocker)”. According to Brockriede (1972), Lenny uses what is called “seduction”. Lenny tries to charm his mother into going along with what his desires are. It can best be shown when he gets up the next morning and goes down to the kitchen, when...

Words: 525 - Pages: 3

Free Essay

Essay #1

...Essay #1 The phone rang; it was 4:30 a.m. My sister-in-law was on the other end of the line frantically telling me to hurry up and get home. I hung up the phone, put my head back down, and fell back to sleep. A few minutes later, the phone rang for a second time, but this time, it was my brother. He told me that they were currently on their way to the hospital. I quickly gathered my things, and within half an hour, I was on my way to the hospital. Hours later, I nervously arrived at the hospital. My clammy hands slid off the steering wheel as my feet unsteadily hit the parking lot pavement. Nearing the doors of the hospital, I felt my regret for not paying attention to the first phone call rise up. I hurried to the elevator, the smell of the sterile hospital air wafting me in the face. The tension in the air was so thick that I could cut it with a knife. Meeting up with my mom and dad, I could see that they were equally anxious and nervous for this moment. I walked quietly into my sister-in-law’s room. I still hadn’t grown used to seeing her in this precarious way (a large, protruding belly). My concern for her was so apparent, my fidgeting was easily giving me away. Giving her a hug, I sensed how aware she was of what was about to happen. I would compare it to that of a child not wanting to have its loose tooth pulled but knows it’s going to happen anyways. After our brief greeting, I slid out the door because the nurse was going to administer an epidural. The day...

Words: 763 - Pages: 4

Premium Essay

Robin Hood Analysis

...1. What problems does Robin Hood have? What issues need to be addressed? Robin Hood has a few weaknesses that he needs to deal with currently. The biggest problem that I see is that his strategy for business needs to be re-evaluated. When he first started his quest he was robbing from the rich and giving to the poor. This strategy and vision worked well for Robin Hood when he was able to give to the poor and sustain his men with the money he took from the rich. As the numbers of his men increased he needed more money and goods to sustain them. As this need has arisen so has the difficulty of robbing. His business has changed, as those traveling through the forest were getting smarter and not carrying as much gold and coin. The rich are also taking a different further route around the forest causing Robin Hoods men to have to travel further or miss the travelers all together. Robin Hood also had the problem of his men being resistant to change. They didn’t see the big picture of why the business had to change. Robin Hood should include all of his top men in the decision process of what their new vision should be. This will help aid the men by including their core values into the vision and mission of the group. Robin Hood needs a well-communicated strategic vision. Robin Hood’s strategy must change because of the changing choices his business has taken and adapting to the new conditions around him. Robin Hood needs to make sure that his new strategy becomes a realized...

Words: 807 - Pages: 4

Free Essay

Robin Hood

...from being caught by the law. Robin Hood was an outlaw. However, he was not the normal outlaw that kills anything, takes anything, or does everything for only for themselves. Robin Hood was an outcast hiding from the law, but there were many people that loved him for the acts that he made to protect them against what they viewed was an unjust government. He was loved by the poor and shunned by the rich. Robin Hood, an outlawed hero in the 1300s, has a legendary history, driven by his unyielding values for justice and desire for balance in social classes, with ideals that have lived on till this day. Robin Hood’s legendary background is well known throughout the world. The author of Robin Hood is unknown. It is most likely a story that the poor told about a man that stole their money back from the rich. Over the centuries, the common people passed this story by word of mouth such that the story grew to be that of a man, Robin Hood, who stood up for something that was wrong in society. This story stayed alive by the affection that the people had for someone who stood up for them, thus the legend grew and grew. After all of these centuries, the author of the story has become the oppressed people that Robin Hood protected and fought for against a greedy government. He originated in the English culture and is known for his devotion to the poor. Robin Hood would rob the rich and give what he robbed to the poor. Most of the time, Robin Hood was robbing the sheriff or...

Words: 1553 - Pages: 7

Premium Essay

China’s Tainted Baby Milk Powder: Rumored Control of Online News

...China’s Tainted Baby Milk Powder: Rumored Control of Online News วันที่ 16 มีนาคม 2007 ทั่วโลกได้รับรู้ว่าสารเมลามีนมีผลเสียต่อไต เมื่อบริษัท Menu foods of Streetvilleในจังหวัด Ontario ประเทศแคนาดาแจ้งว่าอาหารสุนัขและแมวที่มีส่วนผสมที่ได้จากประเทศจีนนั้นมีสารเมลามีนเจือปน หลังจากนั้นไม่นาน เจ้าของสัตว์เลี้ยงได้ฟ้องร้องบริษัทโดยขู่ว่าจะทำให้บริษัทล้มละลาย จนกระทั่งตกลงกันได้ภายในเวลาต่อมา ซึ่งองค์กรอาหารและยาประเทศสหรัฐอเมริกา(U.S. Food and Drug administration: FDA)ได้ทำการตรวจสอบสินค้าและให้ผู้ผลิตอาหารสุนัขรายใหญ่ๆ เช่น Del Monte, Nestle Purina, Menu Foods เป็นต้น ต้องเรียกเก็บสินค้าคืนจากท้องตลาด เมื่อวันที่ 6 กุมภาพันธ์ 2008 FDA ได้ประกาศว่า บริษัทของจีนสองแห่ง และบริษัทของอเมริกาอีกหนึ่งแห่ง ตลอดจนประธานบริษัทและ CEO ได้ถูกฟ้องร้องเนื่องจากได้ทำผิดโดยส่งออกโปรตีนจากข้าวที่มีสารเมลามีนเจือปนอยู่ แม้ว่าเรื่องราวการปนเปื้อนของเมลามีนจะแพร่กระจายไปในช่วงกลางมีนาคม 2007 แต่ประเทศจีนกลับรับรู้เรื่องนี้ในอีก 16 เดือนให้หลัง เนื่องจากรัฐบาลไม่ได้รีบนำเสนอเรื่องราวเหล่านี้เท่าใดนัก วันที่ 16 กรกฎาคม 2008 มีประกาศออกมาว่า ผู้ผลิตนมผงสำหรับเด็กจากประเทศจีนได้ใส่สารเมลามีนซึ่งใช้สำหรับทำส่วนบนของเคาน์เตอร์ เพื่อเพิ่มปริมาณผงนมและจำนวนโปรตีน ซึ่งนมผงที่ปนเปื้อนสารเมลามีนนี้ เป็นสาเหตุการเสียชีวิตของทารก4 คนและทำให้ทารกอีกกว่า 6,200 คนล้มป่วยโดยผู้ผลิตนมผงได้ใช้สารเมลามีนซึ่งมีต้นทุนต่ำเพื่อเพิ่มรสชาติและโปรตีนให้กับนมผง เมื่อวันที่ 8 ตุลาคม 2008 รัฐบาลจีนได้หยุดให้ข่าวเกี่ยวกับผู้ที่ป่วยจากการบริโภคนมผงสำหรับทารก โดยให้เหตุผลว่าอาการป่วยนี้ไม่ใช่โรคติดต่อ จึงไม่มีความจำเป็นจะต้องประกาศให้สาธารณชนรับรู้...

Words: 820 - Pages: 4

Premium Essay

Robin Hood Case

...Robin Hood was a man on a mission but had no plan. He had hoped that strength lay in numbers and the better it would be for him to effectively fight against the sheriff and his administration. The dilemma occurred when the increasing number of men had made the band a corporation. The more men were recruited into the organization, the less face to face interaction Robin had encountered with each of his men. The capacity to fund the increasing number of people became very scarce. Supplies needed to be obtained from outside villages. The cost of buying food was beginning to drain the band’s financial reserves at the very moment when revenues were in decline. Travelers, especially those with the most to lose, were now giving the forest a wide berth. Some issues that needs to be addressed are: How to avoid detection of the growing organization? Has Sherwood Forest become too small to sustain operations? What to do about the growing strength of the Sheriff’s forces? How to address organizational communications and leadership confusion? A formal structure needed to be enforced and a chain of executive management needed to be established so as to monitor the number of people; Merrymen. Robin Hood, if strategizes a new structure and organization of the band, appoints someone in charge of the number of new recruits, seek other ways of finding provisions for his men, he will be on track to achieve success. Robin Hood’s first priority should be to appropriate structure and organization...

Words: 558 - Pages: 3

Premium Essay

Pdftsa

...V the same time as the first time I will have to x the same time as the first time I will have met you and the rest of it. ..........x X X X X I dunno how much you can do to help you find a place in my opinion is that it was the first time I will have to x the same time as the first time I will have to x the same time as the first time I will have to x the same time as the first time I was just wondering if you have shipped this item yet, but I think the only, , xx,Just studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats stressfulJust studying waiting to get my jobseekers money. Whats...

Words: 297 - Pages: 2