Free Essay

Srs Woow

In:

Submitted By 1111112
Words 693
Pages 3
بسم الله الرحمن الرحيم

Name: -------------------------------- Group:---- Level:------- Major:-------------

|المملكة العربية السعودية |[pic] |KINGDOM OF SAUDI ARABIA |
|وزارة التعليم العالي | |Ministry of Higher Education |
|جامعة الإمام محمد بن سعود الإسلامية | |Al-Imam Muhammad Ibn Saud Islamic University |
|كلية علوم الحاسب والمعلومات | |College of Computer & Information Sciences |

CS231: Operating Systems
1st Mid-Term Exam
2nd semester of 1430/1431

Exam Duration: 1:30H
Marks: out of 20

I. Multiple choices [6 Marks, 1 for each]: 1. Which of the following is not shared by different threads of the same process? a. Global variables b. Program counter c. Open files d. None of the above

2. Which of the following process state transitions is NOT correct? a. RUNNIG to READY b. READY to RUNNIG c. WAITING to RUNNING d. WAITING to READY

3. Which of the following programming examples, multithreading provides better performance than a single-threaded solution? a. A web server that responds clients service requests b. A web browser that can process text, sound, and image simultaneously. c. Matrix multiplication where rows can be computed at the same time d. All of the above

4. Which of the following events cannot be categorized as a trap? a. Timer b. Divide by zero c. A user process executes a privileged instruction d. None of the above 5. Which of the following scheduling algorithms do not lead to starvation? a. First Come First Served b. Round Robin with priority c. Shortest Job First d. None of the above

6. Which is a hardware-level mechanism for implementing mutual exclusion? a. Test and Set b. Semaphore c. Monitor d. None of the above

II. Problem1: Process Creation & Communication [4 Marks] 1. Suppose for the following program that the system call fork() always succeed. [pic]

- How many processes are created when it is executed?
|4 processes |

- Draw a picture showing the parental relation between created processes
| |
|[pic] |

2. Put the following system calls in order (by numbering them) for use in a typical shared-memory program: shared_memory = (char *) shmat(segment_id, NULL, 0(

shmctl(segment_id, IPC_RMID, NULL(

shmdt(shared_memory)

sprintf(shared_memory, "Hi there!")

segment_id = shmget(IPC_PRIVATE, segment_size, S_IRUSR | S_IWUSR(

printf("*%s*\n", shared_memory(

III. Problem 2: Scheduling [6 Marks] Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
|Process |Burst Time |Priority |
|P1 |10 |3 |
|P2 |1 |1 |
|P3 |2 |3 |
|P4 |1 |4 |
|P5 |5 |2 |

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5 all at time 0. For each of the following scheduling algorithms, draw Gantt chart and compute waiting time and turnaround time. 1. FCFS: a. Gant chart: [pic] b. Waiting & Turnaround times
|Process |Waiting Time |Turnaround Time |
|P1 |0 |10 |
|P2 |10 |11 |
|P3 |11 |13 |
|P4 |13 |14 |
|P5 |14 |19 |

2. SJF: a. Gant chart: [pic] b. Waiting & Turnaround times
|Process |Waiting Time |Turnaround Time |
|P1 |9 |19 |
|P2 |0 |1 |
|P3 |2 |4 |
|P4 |1 |2 |
|P5 |4 |9 |

3. Non-preemptive priority (a smaller priority number implies a higher priority): a. Gant chart: [pic] b. Waiting & Turnaround times
|Process |Waiting Time |Turnaround Time |
|P1 |6 |16 |
|P2 |0 |1 |
|P3 |16 |18 |
|P4 |18 |19 |
|P5 |1 |6 |

4. RR (quantum = 4): a. Gant chart: [pic] b. Waiting & Turnaround times
|Process |Waiting Time |Turnaround Time |
|P1 |9 |19 |
|P2 |4 |5 |
|P3 |5 |7 |
|P4 |7 |8 |
|P5 |12 |17 |

IV. Problem 3: Synchronization [4 Marks] 1. Consider the following pseudo-code for reader-writer problem [pic] Which kind of process has higher priority, reader or writer? READER, because ???????????????????

2. Below, we define 4 simple threads. Add to these threads semaphore synchronization to ensure that: a. Thread 3 must wait for the end of both thread 1 and thread 2 b. Thread 4 must wait for the end of thread 3
|Shared data (and initialization) |
|int A, B; |
|int X=5, Y=10; |
| |
|/********* Put your semaphores declaration & initialization below this line *******/ |
| |
|Semaphore s1, s2, s3; //they are initialized to 0 |
|Thread1 |Thread2 |
| | |
| | |
|A = X + Y; |B = Y + 1; |
|signal(s1) |signal(s2) |
|Thread3 |
|wait(s1) |
|wait(s2) |
|C = A – B; |
|signal(s3) |
|Thread4 |
| |
|wait(s3) |
|cout

Similar Documents

Free Essay

Silent Dancing

...Silent Dancing – Judith Ortiz Cofer When Cofer says that they were one of the firsts to have a TV in El Building she now realizes that it was because of her father’s decently paying job that they had some finer things than their neighbors did. When her father explains that they should keep to themselves I was confused and then realized that it was so they would not become attached because he had plans for a better place. We all do this at some point. This is my senior year at Central and even though I allowed myself to get close to my roommates I have already started to distance myself by being progressively less present in our pod and in our room. It is easier to say goodbye to something that you do not feel attached to. I feel that by the time I have to say goodbye to my roommates distancing myself will make it less of a ‘change.’ If I start the process now it will hopefully not feel like such a big change. Cofer’s reference to the silent homemade film draws me in when she describes her own experience. “It is both comical and sad to watch silent dancing.” (77) I do this as well; all I could think about is watching some of my own home videos and seeing the facial expressions and the body language of everyone. It is comical. In one of my own videos all four of my siblings and I are going off to school. We were all smiling and in good spirits. When we came back everyone was in a pissed off mood and shoving each other. It is very comical to watch it especially to see the changes...

Words: 563 - Pages: 3

Free Essay

Robinson Crueso

...Max. Speed: 3.2 mach (2,200 mph) Take-off speed: 210 knots Landing speed: 150-155 knots. Uses a drag chute to stop. Service Ceiling: 85,000 ft plus Max. Range: 2,982 miles un-refueled (has flown 18,000 mile missions with in-flight refueling) Weight: 145,000 lb max weight Crew: 2 Cost: $24.616 million in 1972 Total Built: 32 Number Lost: 12(accidents) Number in Museums:  20 as of  Nov 2008 References: The US War Machine, 1983. Ray Bond. Arsenal of Democracy II, 1981. Tom Gervasi. March Field Museum Literature. Lockheed SR71, 1993, Paul Crickmore SR71 in Action, Signal Publications Flight magazine, Feb 2000 Airpower magazine (above, as of 18 April 2013) | | Description | Manufacturer: | Lockheed | Designation: | SR-71 | Version: | A | Nickname: | Blackbird | Type: | General Reconnaissance | Specifications | Length: | 107' 5" | 32.74 M | Height: | 18' 6" | 5.64 M | Wingspan: | 55' 7" | 16.94 M | Empty Weight: | 60000.0 lbs | 27210.0 Kg | Gross Weight: | 145000 lbs | 77097.0 Kg | Propulsion | No. of Engines: | 2 | Powerplant: | Pratt & Whitney J58 | Thrust (each): | 34000 | 14512 | Performance | Range: | 3000 miles | 4669.00 Km | Max Speed: Mach 3.2+ | 2200.00 Mph | 3220.00 Km/H | 1740.54 Kt | Ceiling: | 85000.0 Ft | 25907.0 M...

Words: 252 - Pages: 2

Free Essay

Aerodynamics and Aircraft Performance

...Aerodynamics and Aircraft Performance Characteristics of High-speed Flight Embry-Riddle Aeronautical University From the beginning of the age of manned flight, aviators and engineers have continuously sought to increase the performance envelope. Many parameters for defining aircraft performance exist, but here I’d like to focus on going fast. Since I was a child I’ve been fascinated with military aircraft and the pursuit of speed. From the Bell X-1 to the famed SR-71 Blackbird and beyond, high-speed flight has been a chase toward an ever increasing limit. Several factors contribute to the aerodynamics of supersonic flight and many limitations apply as the envelope is pushed. I will focus the perspective of this paper on design characteristics, engine technology, and atmospheric considerations and take a peek into the future of hypersonic flight. In order to discuss the design characteristics of high-speed aircraft, a definition for the speed regimes must be given. Supersonic flight is typically defined as greater than Mach 1 but less than Mach 3. “High” Supersonic flight is a narrow band of operation from Mach 3 to 5 and hypersonic flight is in excess of Mach 5 (Benson, 2013). Shape technology and wing design are the primary areas of concern in setting out to build an aircraft capable of supersonic speeds. If airflow velocities reach sonic speeds at some location on an aircraft further acceleration results in the onset of...

Words: 1378 - Pages: 6

Free Essay

Advertisement

...2013 EVEREADY: A Part of Every Moment A mother and her son are cuddled up next to each other under a blanket, laughing and having a good time while reading a book about space: the room is dark, and only a flashlight is being used as a source of light. The flashlight is powered by the one and only EVEREADY brand of batteries: the brand for “every family, everywhere, every day.” With women who have children being the target audience of this advertisement, the advertiser plays on the women’s emotions through the good time the women and boy seem to be having, which is made possible by the use of the EVEREADY batteries in the flashlight. Also, the setup of the advertisement as a whole plays a role- what women, who has a child, does not want to cuddle up next to their son or daughter, and use a flashlight to read? The advertiser plays on a mothers need to nurture her child, which also ties in with her need to guide her child. In the advertisement, by cuddling up next to her son before bed with a flashlight, the mother is nurturing her son by spending quality time with him and making memories. She is guiding her son by participating in activities that are beneficial to him at his age, like reading. Mothers everywhere will be able to relate to this because every mother wants to guide and nurture her child. A mother might also be able to relate to the advertisement by how it brings about the feeling of a need to escape. Maybe she has had a bad day, and cuddling up next to her son...

Words: 534 - Pages: 3

Premium Essay

Legal Scenario

...Antonio Raimundo Montana (“Tony”) was once the office manager of Captain Kirk, P.A. (“Firm”). A few of Tony’s duties involved client billing and managing the Firm’s accounts, both the operating and trust accounts. Tony had been at the Firm for over 20 years and was a trusted employee, so much so that the managing partner, Spock, rarely supervised Tony’s actions. When Tony first started at the Firm he would provide Spock a monthly report that detailed the activity of the trust account. Spock required this report as means to comply with the Florida Bar Rule 5-1.1, which mentions that a lawyer must maintain and supervise the trust account. However, as the Firm rapidly expanded and the workload increased, Tony asked Spock to eliminate such “busy” work like that of the monthly report of the trust account. Spock agreed to cease the monthly reports since he had developed a strong sense of trust and loyalty to Tony over the years. Also, Tony had never done anything in the past to make Spock suspicious of Tony’s actions. Spock had to go out of state for a month’s time for a trial. Before leaving, he asked that Tony be on the lookout for a $1 million dollar wire transfer that was expected to be coming in the next couple of days and is to be held within the Firm’s trust account. Tony obliged and said that everything would be taken care of and that the accounting records would be updated once received. While Spock was out of town, he emailed Tony on several occasions inquiring...

Words: 880 - Pages: 4

Free Essay

Phil

...A hairy ingrown toenail with growing fungus, this sounds absolutely disgusting right? I doubt anyone wants to watch or see anything to do with an ingrown toenail with fungus because it is gross, disgusting and scary to look at. So why do people enjoy horror movies so much? It is the same kind of concept, something scares and disgusts us, but when it comes to horror films, shows, and etc. we find it to be pleasurable at the same time. Noël Carroll believes that the thing that attracts us to unpleasant feelings, like being scared and disgusted, is due to the monster. The monster is why there is a paradox of horror. Humans are extremely curious beings of life. Doctor Who season 4 episode 11, “Midnight”, demonstrates Carroll’s philosophy behind why people enjoy horror. “Midnight” starts off with the Doctor trying to convince his partner in crime to join him on a visit to a waterfall made of sapphires, which is located on the planet called Midnight, but she refuses, and the Doctor gets on the Crusader Tour Bus with seven strangers. On his way to Midnight Palace, the bus stops due to “engine” problems; however the Doctor quickly figures out that the Crusader Tour Bus is in perfect condition. The mechanic seems to see an odd shadow that appears to be running toward them, but the driver says its nothing and that help is on the way, reassuring the passengers and the bus attendant that everything will be fine. Suddenly, a random but constant knocking begins. The plot has finally come...

Words: 704 - Pages: 3

Free Essay

Robert Dwney

...Robert Downey Jr. Robert John Downey, Jr. born April 4, 1965, Downey was born in Manhattan, New York, the younger of two children. His father, Robert Downey, Sr., is an actor, writer, producer, cinematographer, and director of underground films, and his mother, Elsie, is also an actress and appeared in Downey Sr.'s films. His father is of half Russian Jewish and half Irish ancestry, and his mother is of German and Scottish descent. As a child, Downey was "surrounded by drugs". His father, a drug addict, allowed Downey to use marijuana at age six, an incident which his father has said that he now regrets. Downey stated that drug use became an emotional bond between him and his father: "When my dad and I would do drugs together, it was like him trying to express his love for me in the only way he knew how." Eventually, Downey began spending every night abusing alcohol and "making a thousand phone calls in pursuit of drugs.” During his childhood Downey had minor roles in his father's projects. He made his acting debut at the age of five playing a sick puppy in the absurdist comedy Pound in the 1970 and then at age seven he appeared in the surrealist Greaser's Palace (1972). When Downey was 10 years old, he was living in England and studied classical ballet as part of a larger curriculum. He grew up in Greenwich Village and attended the Stage door Manor Performing Arts Training Center in upstate New York as a teenager. When his parents divorced in 1978, Downey moved to California...

Words: 491 - Pages: 2

Free Essay

Mssdfawevgdef

...of who is better suited to run the business. Because in family business you can’t have favoritism against fairness. * SIBLING RIVALRY due to selfish motives. * Concern for personal interest instead of business interest which is a selfish trait * There is a GAP IN COMMUNICATION. The actual cause of the gap would be from the top that is from the founder who is Barry Sr. and resulting in miscommunications amongst the children. Another reason being that the age factor amongst them is vast therefore they didn’t even have a personal communication also, so having a business communication was far from the case. * Due to gap of communication there is lack of unity amongst the family members. For example Barry Jrs. Mom went against him too. II. Summarize the facts of the case:- Barry Bingham, Sr. decided sell his family business that had stood running in the family for nearly 70years. The reason for selling being that his children had gone into a sibling rivalry in the business which was indirectly ruining the business relationship plus the personal relationship in the family. As Barry Sr.’s children returned to the business, the sibling conflicts started to rise. Constant questioning about each other’s acts was being raised. It...

Words: 677 - Pages: 3

Free Essay

Robert Doeny How He Came on Top

...Robert Doweny Jr How he came out on top On the 4th of April 1965 in Manhatten , Newyork cityAn American Actor , writer , producer , cinematographer and director Robert Doweny and his wife actress Elsie Ford welcomed their second child Robert Downey Jr into the world . He appears to have been gifted with all of the best that nature and genetic inhereatance can provide , good looks , a gifted actor , singer and a great sence of humour . The success he appercaiates today was however very nearly shortlived . In this article I wish to look at his life from early beginnings to present day . The question for him as with many of us , which has been debated by psycologist for many years , is has the life you have lived and will live (Life stages) down to nature or nurtre . That is to say is it down to the environment in which we live and learned behaviour or due to our genitic makeup . That is to say inhereted ? To answer I have chosen to look at the life of Robert Downy Jr who from a young age perhaps even birth has lived a very complex life where environmental factors have diffently played a major role in the way in which he lives / lived his life how much inheretence was involved with his physical intellectual emotional social development known as P.I.E.S is perhaps something that will be answred by the end of this article , so to be begin at the beginning . For the perpose of this article I have chosen to break up the the life cycle into five...

Words: 4783 - Pages: 20

Premium Essay

I Need

...A Fox’s Tale (Tail) One day a fox was out on a walk, following the same trail that she had once followed when she was just a pup. While walking through the dense woods, it became more and more difficult for her to see where she was stepping. All of a sudden she heard a snap, followed by her own whimpering. Her beautiful tail had been caught in a bear trap. It was only after a tough struggle that she was freed. Although she was no longer trapped, she was still filled with sorrow. Her tail had been cut off and left in the trap. “Oh, how ugly I do indeed look!” Cried the fox, “won’t the other foxes laugh at me?” After racking her brain for quite some time, the fox constructed a plan to prevent being laughed at. Soon after that she called a meeting among her friends and said, “Friends! Have you ever wondered why, after all of the trouble it causes us, we carry these long bushy tails? Let us get rid of them and be free from their nuisance.” To the grief of the fox who was missing her tail, her friends had noticed just that, she was already missing her tail. They laughed aloud and replied, “You used to say that tails looked just fine when your own was okay- and still intact. Now that you’ve lost yours, you want us to lose ours too.” Just as this fox’s friends did, you should always evaluate people's intentions; they may wish to drag you down in order to make themselves feel...

Words: 268 - Pages: 2

Free Essay

Gilbreth

...Frank and Lillian Gilbreth were a husband and wife team of management consultants. They influenced the development of scientific management. Frank Gilbreth pioneered the concept of “motion study and ergonomics”. Lillian Gilbreth was a pioneer in psychology to the problems of management. Frank Bunker Gilbreth was born on July 7, 1868, in Fairfield, Maine. He died in Montclair, New Jersey, on 14 June 1924. When he was three, his father died and the family moved to Boston. After completing school, he passed his entrance examinations for the Massachusetts Institute of Technology. However, he decided to study mechanics in a more practical way and took a job with Whidden and Company Constructions as an apprentice bricklayer. During his term there, he observed that other bricklayers were using different methods to lay brick. These observations were the beginning to Gilberth’s work in motion study. He was granted his first patent for what he called “non-stopping scaffold”. The scaffold not only improved efficiency of bricks laid from 125 to 350 per hour, it also helped reduce the amount of stress and fatigue on the worker’s back. Gilbreth promoted quickly and was made chief superintendent of the company by the age of twenty-seven. In 1895, he set up his own company, based in Boston. By 1900, he was running a very successful business with branches throughout USA. Lillian Moller was born in Oakland, California on 24 May 1878, the daughter of a German-born sugar refiner. She died on 2...

Words: 988 - Pages: 4

Premium Essay

Muhammad Ali

...When you hear the name Ali most people only think of a great boxer, but Muhammad Ali was much more then a boxer he was an inspiration to many americans living in poverty. American soldiers fighting over seas were given strength by this amazing fighter. Muhammad Ali is an unsung heroes in american history. Muhammad Ali was born January 17,1942 (may have been conceived in May 1941) under the name Cassius Marcellus Clay jr. in Louisville, Kentucky. Ali was born to Cassius Marcellus Clay Sr. and Odessa Grady Clay. Ali changed his name after he converted to Muslim in 1975. Ali's road to greatness started when he was 12 years old. When a red and white Schwinn bicycle was stolen, a distraught Ali went to a police station to report the theft. Young Ali reported the theft to police officer Joe Martin, while Ali was telling the officer what happened he said the phrase that would start his career " when I find the person that stole my bike Im going to pummel them". Officer martin ( boxing trainer) told the young man that he needed to train before he started to challenge any one. Officer Martin took Ali under his wing and began to train him. This was the first step on the long road to being a world heavy weight champion and Olympic gold medal.Young Ali trained hard and dedicated all his time to learning as much as he could about the art of boxing. Four weeks later (1954) Ali won his first match by a split...

Words: 261 - Pages: 2

Free Essay

Lillian Mooler

...Lillian Gilbreth was the mother of modern management. Together with her husband Frank, she pioneered industrial management techniques still in use today. She was one of the first "superwomen" to combine a career with her home life. She was a prolific author, the recipient of many honorary degrees, and the mother of 12. She is perhaps best remembered for motherhood. Her children wrote the popular books Cheaper by the Dozen and Belles on Their Toes about their experiences growing up with such a large and famous family. But Lillian Moller Gilbreth was not only a mother; she was an engineer and an industrial psychologist. Lillian excelled in high school and decided that she wanted to study literature and music. Her father did not believe in higher education for women. He felt they needed only enough knowledge to manage a home gracefully. But Lillian persuaded him to let her attend the University of California at Berkeley while living at home and maintaining her family duties. When she obtained her B.A. in literature in 1900, she was the first woman to speak at a University of California commencement. She went to Columbia, but illness forced a return to California after her first year. Undaunted, she went back to Berkeley and received a master's degree in literature in 1902. She celebrated by planning a vacation. She spent some time in Boston before embarking, and there she met her future husband. Frank Gilbreth, who never went to college, was interested in efficiency in the...

Words: 577 - Pages: 3

Free Essay

History

...University of West Alabama The Murder of Helen Jewett by Patricia Cohen HY513 Jeanette Hollis May 2, 2010 The Murder of Helen Jewett by Patricia Cohen is a non fiction entertaining and dramatic book that discusses several perspectives of Victorian era New York City. This narrative is about men and women, clerks, prostitutes, legal codes, tabloid journalism, politics and capitalism. This book is considerably more than a shocking murder and trial as it becomes a carefully investigated examination of a growing city. Helen Jewett born Dorcas Doyen, simply a prostitute, one of many dishonored working women in New York City was murdered and set on fire by her attacker. The suspect, Richard P. Robinson was a normal young man about town working in business and frequenting brothels. Although severe attacks were accepted in antebellum cities, prostitutes frequently endured abuse and exploitation. Helen Jewett’s murder was one of the first crimes where a mixture of sex, lies and violence revealed to the public gender inequities and class privilege that had previously been hidden from society. Helen Jewett was born in Augusta Maine. When her parents died a local judge adopted her and tried to educate her. Helen was very beautiful and had an affair with a banker which became a scandal. Helen moved to New York City. She became employed at one of the many brothels operating in New York at that time. Richard Robinson, the suspect in Helen Jewett’s...

Words: 572 - Pages: 3

Free Essay

The Progressive Era Essay 5 Para..

...As the 1800s came closer and the beginning of a new century appeared, America experienced many problems due to rapid urbanization, industrialization, and immigration. As a result, many Americans found it very hard to make changes in society to improve life for everyone. These Americans were known as Progressives and they pushed for reform aggressively. One of the most famous Progressives was our 26th president, Theodore Roosevelt. He prompted reform in many different areas and as a result created his own political party, The Progressive Party, nicknamed The Bull Moose Party. The Progressives wanted to control many economical issues that were impacting society. Its platform included women's suffrage, tariff reduction, stricter regulations on businesses, a ban on child labor, an eight-hour work day, a federal workers' compensation program, and the direct election of senators. Political machines - powerful organizations linked to political parties - controlled local government in many cities. In each ward, or political district, within a city, a machine representative controlled jobs and services. This representative was the political boss. The bosses gained votes for their parties by doing favors for the people such as offering turkey dinners and summer boat rides, providing jobs for immigrants, and helping needy families. A political boss was often a citizen’s closest link with local government. Although they did help people, many bosses were dishonest. Robert la Follette...

Words: 703 - Pages: 3