Free Essay

Sql Locks

In:

Submitted By jumbojet
Words 672
Pages 3
This assignment verifies that you understand how shared and exclusive locks work. Suppose that S1, S2, and S3 are sessions connected concurrently to the same database instance. Suppose further that D1, D2, and D3 are data objects that can be locked with a shared and exclusive lock. For the ten locking situations below, indicate, for each session, whether it procures the requested lock, waits, or deadlocks.

S1 has a shared lock on D1 and S2 attempts to procure a shared lock on D1.
Since s1 has a shared lock on D1 and the other sessions can procure the lock without any waiting for release by s1.so s2 can procure a shared lock on D1 *
S1 has an exclusive lock on D1 and S2 attempts to procure a shared lock on D1. * Since S1 has a exclusive lock on D1 any other sessions cannot procure a shared lock on D1.The other sessions has to wait till S1 releases the lock. so S2 has to wait until S1 releases exclusive lock on D1

S1 has a shared lock on D1 and S2 attempts to procure an exclusive lock on D1. * Since exclusive locks can be made on a data instance only when its not accessed by any other sessions.S2 must wait until S1 commits in order to procure an exclusive lock on D1

S1 has an exclusive lock on D1 and S2 attempts to procure an exclusive lock on D1. * Since exclusive locks can be made on a data instance only when other sessions have not made shared lock or exclusive lock on that data instance. so S2 must wait to begin until S1 commits in order to procure an exclusive lock on D1

S1 has a shared lock on D1, S2 has a shared lock on D1, and S3 attempts to procure a shared lock on D1. * Since shared locks can be procured even when other sessions have made shared locks on the same data instance.A data instance can be accessed by any no of database
S3 can procure a shared lock on D1.
S1 has an exclusive lock on D1 and a shared lock on D2, and S2 attempts to procure an exclusive lock on D2. * Since exclusive locks can be made if no other sessions have made any kind of locks on the same data object,S2 must wait until S1 unlocks D2 in order to procure an exclusive lock on D2.

S1 has a shared lock on D1 and a shared lock on D2, and S2 attempts to procure a shared lock on D2. * Since shared locks can be made even when any no of sessions access the same data object, * S2 can procure a shared lock on D2.

S1 has a shared lock on D1 and a shared lock on D2. S2 has a shared lock on D2 and attempts to procure an exclusive lock on D1. * Since D1 is locked by S1 for a shared lock S2 must wait until S1 unlocks D1in order to procure an exclusive lock on D1 *
S1 has an exclusive lock on D1 and is waiting for an exclusive lock on D2. S2 has an exclusive lock on D2 and is waiting for an exclusive lock on D1. * Since s1 is waiting for data object D2 which is locked exclusively by s2 and s2 is waiting for data object d1 which is locked exclusively by D1, this situation leads to a deadlock. *

S1 has an exclusive lock on D1 and is waiting for an exclusive lock on D2. S2 has an exclusive lock on D2 and is waiting for an exclusive lock on D3. S3 has an exclusive lock on D3 and is waiting for an exclusive lock on D1. * Since s1 is waiting for data object D2 which is locked exclusively by s2 and s2 is waiting for data object D3 which is locked exclusively by D3 and s3 is waiting for a instance d1 which is locked exclusively by s1 this situation leads to a deadlock.

Similar Documents

Premium Essay

Resources

...Resource Allocation Graphs Roger Henriksson Department of Computer Science Lund University The possibility of deadlock is an undesired property (to say the least) of safety-critical real-time systems. Therefore, a method to verify that a system cannot deadlock, or to detect possible deadlock situations, is of tremendous value. One such method is resource allocation graphs. As stated in Operating System Concepts by Peterson and Silberschatz [PS85], the occurrence of deadlock requires among other things that hold-wait situations exist and a circular chain of such hold-waits must exist. A resource allocation graph attempts to graphically illustrate all the hold-wait situations in a system. In this graph it is possible to search for cases of circular hold-wait. In their book, Peterson and Silberschatz [PS85] (Section 8.2.2) introduce a method for drawing resource allocation graphs. However, in their version the resource allocation graph shows all the hold-wait-states that exist at any one given point in time. This is a good tool for illustrating a transient state in the system, but in order to use their version of the graphs for detecting any possible deadlock situation we would have to draw a graph for each and every possible combination of execution state for all threads in the system. Then, each and every one of these graphs would have to be analysed for cycles indicating circular wait. This is clearly unpractical. Instead, we modify the method of drawing resource...

Words: 1937 - Pages: 8

Free Essay

Computer Science C++

...Special Report Bundle C++Ox: The Dawning of a New Standard Contents C++0x: The Dawning of a New Standard It's been 10 years since the first ISO C++ standard, and 2009 will bring us the second. In this special report, DevX delves into the new features being discussed by the standards team. Learn how these new features will revolutionize the way you code. Overview: C++ Gets an Overhaul It's been 10 years since the first ISO C++ standard, and 2009 will bring us the second. Learn about the new features being added and how they will revolutionize the language. Easier C++: An Introduction to Concepts C++0x concepts bring the full power of the Generic Programming paradigm to C++, making templates more expressive, easier to write, and easier to use. Spectacularly poor template error messages are a thing of the past! Simpler Multithreading in C++0x The new standard will support multithreading, with a new thread library. Find out how this will improve porting code, and reduce the number of APIs and syntaxes you use. The State of the Language: An Interview with Bjarne Stroustrup C++ founding father assesses the language on the eve of its new standard. Timeline: C++ in Retrospect From its nascent pre-processor in 1979 to today's incredibly sophisticated language features and libraries, we've documented each step along the way. C++0x: The Dawning of a New Standard Overview: C++ Gets an Overhaul Overview: C++ Gets an Overhaul C++Ox: The...

Words: 6570 - Pages: 27

Free Essay

Take a Stand

...TAS #6 Marissa Cooney July 16, 2013 Summary: The colon zone is an area that allows for a ton of money to be brought into Panama. This is a site to hold containers and tons of merchandise with the best designer labels. It has accounted for $10 billion a year to be brought into the country. That is 7.5% of the GDP. The Panama Canal is home to the largest and most important shipping lines in the world. The canal is the cornerstone of the Panama economy. Increasing foreign investments is the goal in order to fuel the growth of the Panama economy. Real estate prices are soaring here and new commercial projects and residential communities are popping up everywhere. There is also 0% employment here because of the land-rush. Panama was recently rated number one to retire in for its quality of life, securities, health services and value for your money. Point of View: This will have much value to both Panama and US companies as imports are accounting for 45% of the Panama income brought in. The Panama Canal is welcoming more and more shipments, increasing sales to both countries. Panama is also expanding their businesses located there encouraging US companies to expand into the territory. This is very good for the US as it will increase sales and provide more income into the US. Panama companies will continue to thrive, and so will the US businesses conducting business with them. Panama is providing many opportunities for advancement, and is attracting many people to move...

Words: 320 - Pages: 2

Free Essay

Due Process

...MGT 565 | Just Cause Assignment | Stephanie Bourdo | 1/29/2013 | Section 1 – Due Process A. Arguments to support Maria was provided due process: * Maria was part of a group that was given a formal verbal warning and reminder of the policy regarding no company property other than protective gear or clothing could be in employee’s lockers. * The verbal warning/reminder ended with a statement indicating that anyone caught violating the rule would be subject to discipline, including the possibility of discharge. * There is a formal policy that is listed in the employee handbook which Maria received upon starting that states “willfully removing or unauthorized possession of property or documents of the Company will constitute just cause for disciplinary action, up to and including discharge.” * Management did not just take Cecelia’s word for the fact that Maria had company property in her locker, they actually checking and confirmed. * Maria was given an opportunity to explain herself regarding the company property in her locker. * Maria was not immediately released; she was suspended without pay while the company did a further investigation. * After the investigation resulted in understanding that company property in lockers was a common occurrence, Maria was given another chance to explain/defend her situation. B. Arguments to support that Maria was NOT provided due process: * Maria may argue that although she was given...

Words: 1191 - Pages: 5

Free Essay

Someone Who Influenced My Life

...this strange at first, it became clear later as to why he used a Gorilla in the first place. The Gorilla here represents nature's voice and is a reminder that we need to look for ways to communicate with nature, first hand. This was the first eye opening aspect from the author. The second was the author's penchant for coming up with brilliant stories to derive and communicate his point to the reader. Instead of driving in his philosophies by pure theory would have been boring and heavy, but the author uses wonderful and thought provoking stories to do the same, so effectively. The first was the simple concept of food kept under lock and key. This is a practice that comes so naturally to us, but he brings out why this is a very unnatural way of things. For early man, what grew in the world belonged to everyone in the society, and to put it under lock and key is to basically create a working class who will do tasks, useful or useless, in order to earn their bread. Ishmael's (the name of the gorilla) teachings turn toward the subject of formal education, which he argues is merely a way to keep children out of the work force and is otherwise unnecessary because humans learn on their own, naturally following their own interests and picking up information necessary to operate in their culture. In tribal cultures, this information inherently includes that which is relevant to surviving in the wild by learning to hunt and gather food, as well as easily adopting their culture's values...

Words: 593 - Pages: 3

Free Essay

Monroe Lock Security

...Case 1 “A Monroe Lock Security Systems” Ray Monroe was the owner of “A Monroe Lock Security Systems”(AMLSS)Ray’s business was established 2 years ago and offered lock-smithing services to residential and commercial customers as well as automobile owners in the greater Boston area. AMLSS was certified by the Commonwealth of Massachusetts to perform alarm installation and offered a full range of alarm products as well as rekeying, lock and deadbolt installation, master key systems, emergency residential lockouts, foreign and domestic automobile lockouts and window security locks. Financial outcomes were not the best, with loses of $6500 in the first year and a profit of only $3500 in year 2. As of right now AMLSS’s target market is 3 local communities in the Boston area. Ray was the only child of parents who were both successful entrepreneurs. He had substantial inheritance that would satisfy any of his financial needs for the rest of his life. For years Ray worked with a friend who owned a security and alarm manufacturing business in the western side of the state. Ray also entered a special program to learn more about the locksmith business so that he can start his own lock and security business. He learned that utilizing his experience will help him to become successful businessman. Monroe Lock and Security Systems offered almost all locksmith services excluding alarms. He assumed that there were already many large competitors in the alarm market that would be able to...

Words: 455 - Pages: 2

Free Essay

Speaker Evaluation/Jerome Reinholt

...Speaker evaluation by Jerome Reinholt. Speech: “How To Stay Calm When You Know You’ll Be Stressed” by Daniel Levitin (YouTube) 1. How does the speaker open speech? What works well in their introduction? The speaker opens the speech with a story about being locked out of his house in Canada when it’s forty degrees outside. What works well with his introduction is his humorous story about being locked out of his house and having to break his basement window to get inside his house. 2. How is the speech organized? Does it flow smoothly? The speech, in my opinion was not that organized and did not flow smoothly. It was a speech that started with the topic of basic home organization; then went into detailed health issues; and then ended with a mention of the speakers opening remark about how home organization will help the speaker in the future. 3. What are the main points and are they clear? The main points of the speech were….? I am still not sure of the main points. It was very unclear what the main points of this speech were. I honestly feel he was called upon to speak to fill in for someone else at the last minute. He gave a speech, but it was a rambling talk. He had zero visual aids even though several huge screens were available for possible power point presentations. 4. What facts, quotes, stats, or stories does the speaker includes? The speaker gave facts, quotes, stats, etc. such as: GlaxoSmithKlein estimates that 90 percent of drugs work in...

Words: 512 - Pages: 3

Premium Essay

Pros And Cons Of Emergency Locksmith Company

...An emergency locksmith company is equipped to do more than just assist you with getting back into your residence or vehicle. Highly regarded locksmiths like Locksmith CityName will inspect the current locks and ensure the items are in correct working order. Additionally, they’ll improve security necessary to help you maintain personal valuables and restore your sense of safety. Think Ahead There are various skills and traits that a professional locksmith must have in order to be grow a business, become and much sought after locksmith and be successful. These lock pros have mechanical knowledge and lauded skills which lend themselves to be able to form lasting relationships with local customers. Safes and locks of all types interest locksmiths...

Words: 405 - Pages: 2

Free Essay

Research on Historic Poems

...just one flavor good enough for me, yeah me Don't gimme no crummy taste spoon I know what I need Baby, I love rocky road So weren't you gonna buy half a gallon, baby I love rocky road So have another triple scoop with me, ow They tell me ice cream junkies are all the same All the soda jerkers know my name When their supply is gone Then I'll be movin' on But I'll be back on Monday afternoon, you'll see Another truck load's comin' in for me, all for me I'm singin' I love rocky road So weren't you gonna buy half a gallon, baby I love rocky road So have another triple scoop with me, ow (oh, make it talk) When I'm all alone, I just grab myself a cone And if I get fat and loose my teeth that's fine with me Just lock me in the freezer and throw away the key Singing I love rocky road So weren't you gonna buy half a gallon, baby I love rocky road So have another triple scoop with me I love rocky road So weren't you gonna buy half a gallon, baby I love rocky road So have another triple scoop with I love rocky road So weren't you gonna buy half a gallon, baby I love rocky road So have another triple scoop with I love rocky road So weren't you gonna buy half a gallon, baby I love rocky road So have another triple scoop with...

Words: 288 - Pages: 2

Free Essay

Interpersonal Conflict

...car-jacking was not taken well by either of them but particularly by Jean. The car-jacking revealed racial bias or outright prejudice and lack of trust on Jeans part when a Hispanic locksmith comes to change the locks on their house because they’re car keys would give the car-jacker’s access to their house. Jean tells Rick that she thinks that the lock smith is going to have his gang come back and rob the house. She attributes him being gang affiliated due to his shaved head and multiple tattoos. Rick is passive in this conflict and his resolution is more to calm Jean than to point out her flawed way of thinking, mainly her racial bias towards the locksmith and the fact that the car-jacking was likely an isolated incident in itself. Rick’s failure is to point out to Jean her flawed way of thinking, including her racial bias towards the locksmith. Their being carjacked is scary and life altering event in itself, but it should not create permanent discord and racial tension because the carjackers where minorities. Rick fails to point out Jeans racial bias when she tells him what she thinks that locksmith, Daniel, is going to do. This is made ever more omniscient by the fact that Daniel, can hear Jean voice her fears and racial undertones to Rick while he is working on the locks. Rick’s passiveness is seemingly due to him seeking to consol his wife who has not recovered from being car-jacked and to reassure her that everything is going to be alright. He makes no effort to confront...

Words: 665 - Pages: 3

Free Essay

Robert Frosat Poem 10

... Is also great And would suffice. HOUSE FEAR by: Robert Frost (1874-1963) LWAYS--I tell you this they learned-- Always at night when they returned To the lonely house from far away To lamps unlighted and fire gone gray, They learned to rattle the lock and key To give whatever might chance to be Warning and time to be off in flight: And preferring the out- to the in-door night, They learned to leave the house-door wide Until they had lit the lamp inside. A LATE WALK by: Robert Frost (1874-1963) HEN I go up through the mowing field, The headless aftermath, Smooth-laid like thatch with the heavy dew, Half closes the garden path. And when I come to the garden ground, The whir of sober birds Up from the tangle of withered weeds Is sadder than any words. A tree beside the wall stands bare, But a leaf that lingered brown, Disturbed, I doubt not, by my thought, Comes softly rattling down. I end not far from my going forth By picking the faded blue Of the last remaining aster flower To carry again to you. THE LOCKLESS DOOR by: Robert Frost (1874-1963) T went many years, But at last came a knock, And I thought of the door With no lock to lock. I blew out the light, I tip-toed the floor, And raised both hands In prayer to the door. But the knock came again My window was wide; I climbed on the sill And descended outside. Back over the sill I bade a “Come in” To whoever...

Words: 946 - Pages: 4

Free Essay

Deadlock Detector and Solver Research Paper

...use multiple threads in order to take advantage of hardware parallelism. Java is one of the first languages to make multithreading available to developers. Along with advantages of concurrent systems and multithreading, there are some challenges involved. Java has inter-process communication model which means it has set of methods for exchange of data among multiple threads and processes. It is based on shared data structures and meshes well with hardware architectures in which multiple cores share memory. However Java is susceptible to deadlocks. Deadlock is a condition under which the entire program is halted as each thread in a set attempts to acquire a lock already held by another thread in a set. Java is susceptible to deadlocks because (a) threads exchanges information by sharing variables that they lock with mutex locks and (b) the locking mechanism interacts with other language features, such as aliasing. Consider a simple banking transaction example. [pic] Figure 1: Deadlock scenario in banking transaction .In this case if there are two threads attempting to run transfer(a,b) and transfer(b,a) at the same time then deadlock is going to occur because both threads try to acquire the resources in reverse order. Once a program is deadlocked the source of deadlock is difficult to determine making it difficult to resolve the deadlock....

Words: 3641 - Pages: 15

Free Essay

Manage

...SPECIFIC SITE DUTIES Morning Guard: Commencing around 0250hrs. Rostered hours – 0300hrs to 1130hrs ½ Hour meal at approximately 0830hrs. Off duty 1130hrs after change over and briefing oncoming guard. Unlock and re-lock main gates on entry, unlock gatehouse, sign on in log book and time sheet. Ring mobile night guard let him know you are on site, ring SMC, and let them know you are on site, getting the name of the operator and logging it, disarm alarms in both Warehouse and Administration, (either set of two panels is all that is necessary). Turn all lights on as instructed, commence internal and patrol, unlock side gates and open, unlock manual lock on front sliding doors to reception. (Await Duty Manager to arrive.) When above is completed re-open main gates, (one needs to be secured open with small chain) meet and greet staff (from approximately 0400hrs on) and commence logging trucks, Toll Fast vehicles and couriers etc. Log all casual, contractor and staff, who need access cards in register, remember to issue correct card, ie: warehouse/casual card – admin/staff card/Contractors. All staff, visitor and contractor vehicles are to be searched on leaving the site ie. Boot and wheel well, glove box, consol and behind front seats. Note: This applies to all staff. Random ID checks at least once a week if possible. Bag searches when possible of outgoing staff. NOTE: DEFINATELY NO DELIVERY TRUCKS BEFORE 0700hrs ARE PERMITTED PAST SIDE GATES...

Words: 1350 - Pages: 6

Free Essay

Computer

...pare the processors’ access to printers and other I/O devices for the master/slave and the symmetric multiprocessing configurations. Give a real-life example where the master/slave configuration might be preferred. 2. Compare the processors’ access to main memory for the loosely coupled configuration and the symmetric multiprocessing configurations. Give a real-life example where the symmetric configuration might be preferred. 3. Describe the programmer’s role when implementing explicit parallelism. 4. Describe the programmer’s role when implementing implicit parallelism. 5. What steps does a well-designed multiprocessing system follow when it detects that a processor is failing? What is the central goal of most multiprocessing systems? 6. Give an example from real life of busy waiting. 7. In the last chapter, we discussed deadlocks. Describe in your own words why mutual exclusion is necessary for multiprogramming systems. 8. Compare and contrast multiprocessing and concurrent processing. Describe the role of process synchronization for both systems. 9. Describe the purpose of a buffer and give an example from your own experience where its use clearly benefits system response. 10. Consider this formula: G = (A + C2) * (E1)3 / D + B a. Show the order that a processor would follow to calculate G. To do so, break down the equation into the correct order of operations with one calculation per step. Show the formula for each step. b. Find the value of G: if...

Words: 324 - Pages: 2

Free Essay

Discussion

...Four  people  are  selling  tickets  at  the  same  time.  The  number  of  all  tickets  is  40.  Each   ticket  only  can  be  sold  one  time.   import java.util.concurrent.locks.ReentrantLock; public class ThreadTest implements Runnable { int tickets = 40; ReentrantLock lock = new ReentrantLock(); public void run() { while (true) { lock.lock(); try { if (tickets > 0) { System.out.println(Thread.currentThread().getName() + "is selling NO."+ tickets + " ticket."); --tickets; } lock.unlock(); } catch (Exception e) { lock.unlock(); } } } }     public class Demo1 { public static void main(String[] args) { ThreadTest tt = new ThreadTest(); Thread t1 = new Thread(tt); Thread t2 = new Thread(tt); Thread t3 = new Thread(tt); Thread t4 = new Thread(tt); t1.start(); t2.start(); t3.start(); t4.start(); } } result: Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is   selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling...

Words: 613 - Pages: 3