Free Essay

# Bankers Alogoirthm

Submitted By ranjith23
Words 406
Pages 2
CSEN5322 – Operating Systems
Homework-5
Student Name | Student ID | Section | Date | | | | |

Bankers Algorithm

The Banker's algorithm is a resource allocation and deadlock avoidance algorithm. Using C++ programming language, implement the Banker's algorithm for deadlock avoidance.
5 <= # of process, P0 ~ P4
4 <= # of resource, A ~ D
0 0 1 2 <= Allocation
1 0 0 0
1 3 5 4
0 6 3 2
0 0 1 4
0 0 1 2 <= Max
1 7 5 0
2 3 5 6
0 6 5 2
0 6 5 6
1 5 2 0 <= Available

5 <= # of process, P0 ~ P4
4 <= # of resource, A ~ D
0 0 1 2 <= Allocation
1 0 0 0
1 3 5 4
0 6 3 2
0 0 1 4
0 0 1 2 <= Max
1 7 5 0
2 3 5 6
0 6 5 2
0 6 5 6
1 5 2 0 <= Available

Input a txt file that includes the number of processes, resources, and the matrixes for allocations, max, and available.
Output Safe or Unsafe 1) Read the # of processes and the # of resources 2) Read allocation, max and available for each process and each resource 3) Print whether this system is safe or not to the output file.

Data Structures for the Banker’s Algorithm
Input.txt
Input.txt
Let n = number of processes, and m = number of resources types.
Available: Vector of length m. If available [j] = k, there are k instances of resource type Rj available
Max: n x m matrix. If Max [i,j] = k, then process Pi may request at most k instances of resource type Rj
Allocation: n x m matrix. If Allocation[i,j] = k then Pi is currently allocated k instances of Rj
Need: n x m matrix. If Need[i,j] = k, then Pi may need k more instances of Rj to complete its task
Need [i,j] = Max[i,j] – Allocation [i,j]

Safety Algorithm
1. Let Work and Finish be vectors of length m and n, respectively.
Initialize:
Work = Available
Finish [i] = false for i = 0, 1, …, n- 1
2. Find an i such that both:
(a) Finish [i] = false
(b) Needi ≤ Work
If no such i exists, go to step 4
3. Work = Work + Allocationi
Finish[i] = true go to step 2
4. If Finish [i] == true for all i, then the system is in a safe state

### Similar Documents

#### Banker

...Islamic Banking: True Modes of Financing By Dr. Shahid Hasan Siddiqui, Eminent Pakistani Banker & Economist Introduction Prohibition of interest is ordained in Islam in all forms and intent. This Prohibition is strict, absolute and unambiguous. The Holy Qur'an in verse 278 of Surah Al- Baqarah states: "O ye who believe! Fear Allah and give up what remains of your demand for riba, if ye are indeed believers." and verse 2: 279 says "If you do it not, take notice of war from Allah and His Messenger. But if ye turn back, ye shall have your capital sums. Deal not unjustly and you shall not be dealt with unjustly." It therefore, follows that interest is prohibited as it leads to injustices (zulm) and Islam is against all forms of injustices and exploitations and pleads an economic system, which aims at securing extensive socio-economic justice. The Islamic law of prohibition of riba, which includes interest, was originally not based on economic theory but on Divine Authority which considers the charging of interest as an act of injustice. There could be no denying of the fact that under the interest-based system of banking or in a system not strictly based on the principles and spirit of Shari’ah, depositors as well as borrowers are exploited in one form or the other. It is however, significant to note that, as in the case of conventional banking, the depositors are being exploited most under the system and practices enforced by banks and financial institutions operating......

Words: 4793 - Pages: 20

#### 13 Bankers Review

...13 Bankers: The Wall Street Takeover and the Next Financial Meltdown 13 Bankers: The Wall Street Takeover and the Next Financial Meltdown, by Simon Johnson and James Kwak, is an analysis of the banking system in America and how they contributed to the financial crisis of 2008. These banks were facing the possibility of bankruptcy, and in turn the American government had an increasing need for these banks as the means to fund the necessary investments in the economy. 13 bankers, breaks down the American banking industry in how they have grown so big, so profitable, that they have become resistant to regulations. The banks grown to the enormous that the stability of the economy was dependent, giving they a political influence by pouring money into campaigns of congressional candidates and congressmen, assuring investment banks to maintain influence and position in the White House and the Treasury department. Theses “megabanks” had balance sheet assets that accounted for more than 60 percent of the country’s gross domestic product. In March of 2009, the presidents of thirteen of these “Megabanks” met at the White House with the President, Obama that gave a message, “everybody has to pitch in. We’re all in this together” –President Obama (13 Bankers, page 4) this message giving a clear indicator the thirteen bankers needed the government and in turn, the government needed these 13 bankers to maintain stability of the economy. Thomas Jefferson was strongly suspicious of......

Words: 2265 - Pages: 10

#### Are Bankers Undercompensated?

...Are Bankers Undercompensated? The general public, more often than not, has the impression that bankers are the evil seed in the macro corporate environment. So, we need to ask ourselves, why? This notion is primarily based on the fact that “our economy is only as good as our banks,” therefore, CEOs are responsible for the country’s economic performance. Secondly, one of a bank’s many roles is to take care of people’s accounts, thus, in time of crises it is easy for individuals to make them liable for their uncomfortable financial position. Additionally, it is needles to say that these top executives are public figures, making it easy for people to put a name and face as the target of their dissatisfaction. Finally, in order for us to evaluate their compensation we need to draw a parallel between their performance as CEOs and their salary (including bonus), as well as compare them to CEOs in other industries. To assess performance, take into consideration that a country’s GDP is broken-down into four components: personal consumption expenditure, which is further broken down into goods and services; business investment; government spending; and net exports of goods and services. With the greatest US GDP contributor being personal consumption expenditure, services alone accounted for 46% of what the nation produced in 2011; and, the banking industry falls into that category. Moreover, if you take a look at exhibit1, which shows a further detailed breakdown of the US’s GDP...

Words: 711 - Pages: 3

#### Banker

... | |Making and following the service request for the complex problems. | |Represent and illustrate Etisalat new promotions and services. | | | | | |2-BANQUE MISR  HEAD OFFICE – BANKER A( From November 2010 till now) | |Training employees  in Banque Misr branches | |on all products of banquemisr(credit cards, | |debit cards, time of deposit, certificate of deposit, | |day by day accounts) and how to use it on CRM ...

Words: 592 - Pages: 3

#### Libyan Arab Foreign Bank vs. Bankers Trust Company

...Case: Libyan Arab Foreign Bank vs. Bankers Trust Company Queen’s Bench Division, Commercial Court Facts: US President Ronald Reagan places a Presidential order to freeze money that was deposited in the Bankers Trust Company. The Libyan Arab Foreign Bank sought to recover the funds. Procedure: Queen’s Bench Division, Commercial Court Issue: Can the Bankers Trust Company pay the Libyan Arab Foreign Bank the money that was withheld due to the freeze President Reagan put on the money in 1986? Can one government block assets held by bank branches in another country? Holding: (Vote: 1-0) Yes, however this puts the Bankers Trust Company in a conundrum because although British law requires them to pay back the Libyan Arab Foreign Bank, they will violate the US Presidential order (Bennett, 1987). Reasoning: (Staughton, J.) A. Rule: The London court rules in favor of the Libyan Arab Foreign Bank in the amount of \$292 million, which the Bankers Trust Company has to pay. The money was frozen be US Presidential order in 1986. B. Application: The London courts ruled the money belonged to the Libyan Arab Foreign Bank and had to be refunded. The London courts ruled the money belonged to the Libyan Arab Foreign Bank and that the agreement under which the money was deposited entitled them to receive the deposit bank and the Bankers Trust Company would be held accountable for not refunding the money. This conflict is complex due to the nature of the rulings given by......

Words: 398 - Pages: 2

Free Essay

#### Micro Banker

... Certificate | COMPETENCIES. | * Proficient in the following computer skills; * Statistical Analysis System. (SAS). * Computer operation system. * Microsoft office and PageMaker. | AWARDS | * Certificate of participation in YADSTI (Youth Agency for Development of Sciences, Technology & Innovation) * Ascent leadership experience certificate by THE JOURNEY (Christian organization). * Certificate of participation in tree planting activity at Ngong Road Forest station. * Certificate of participation in provincial science congress 2004 and 2005. | WORK EXPERIENCE.2013 – Upto date June 2012NOV 2011Nov 2005 – Jan 2006 | Working with Kenya Commercial Bank as sells and Marketing Representative (Micro banker)Mapping assistants Kitutu Masaba Constituency in preparation for voter registration. IEBC Officer at the Tallying Centre in Kitutu Masaba by Election.Kisii General Hospital (Currently level five)Doing Social Work.Voluntarily cleaning the hospital. | Feb 2006 – Oct 2006 | Mong’oni Secondary schoolPosition: Administration and staff member.Responsibilities * Registration of new students * Coordinating on the external examinations for the candidates. * Teaching mathematics and chemistry. | | LEADERSHIP ROLES | * Organizing secretary Vijana......

Words: 480 - Pages: 2

#### Investment Banker Turned Farmer

...Investment Banker Turned Farmer Victoria Rego Saint Leo University Leaving a prominent job as an investment banker in New York City and moving to the farmlands of Illinois is compelling. The information provided by the Wall Street Journal and found online is very convincing. The demand for corn to convert into ethanol will be high, along with the price of an acre of prime farmland is low, at \$10,000 (Brickley, Smith & Zimmerman, 2009). The price of this farmland is also expected to increase, another fact to encourage this business venture. Reselling the land years down the road is expected to make a profit. Also, someone who is smart should be able to learn how to grow corn. Unfortunately, no matter how compelling this venture is, and the facts that may convince the success of this venture, it is not worth the risk. This investment banker’s friends are not giving him good advice. One of the biggest and most obvious risks is that this investment banker does not know how to farm. Odds are he has lived in the city his whole life, and not even stepped foot on a farm. Growing corn on uncultivated land is difficult; it would require large amounts of fertilizer, herbicides, and pesticides (Reeves, 2009). These chemicals would then end up in farmland runoff and cause harm to the environment. It is also important to rotate crops, growing and harvesting products other than corn. What will this investment banker turned farmer do with these crops? This results in even more...

Words: 526 - Pages: 3

#### Libyan Afb V Banker Trust Co

...THE LIBYAN ASSET FREEZE AND ITS APPLICATION TO FOREIGN GOVERNMENT DEPOSITS IN OVERSEAS BRANCHES OF UNITED STATES BANKS: LIBYAN ARAB FOREIGN BANK v. BANKERS TRUST CO. Corinne R. Rutzke* INTRODUCTION United States asset freezes are political weapons invoked in response to international crises.' Traditionally, United States asset freezes have blocked foreign government assets within the jurisdiction of the United States.2 Following the 1979 Iranian hostage crisis, however, United States peacetime asset freezes have attempted to block dollar-denomi4 nated accounts3 held in foreign brancheS of United States banks.5 An important legal issue associated with the use of peacetime blocking * J.D. Candidate, 1988, Washington College of Law, The American University. 1. OFFICE OF FOREIGN ASSETS CONTROL, BLOCKED FOREIGN ASSETS IN THE UNITED STATES 1, 3 (1985) TREASURY PAMPHLET]. Historically, the blocking control orders, promulgated pursuant to section 5(b) of the Trading with the Enemy Act, authorized the President to regulate or prohibit any property transaction involving a foreign country or national during wartime. Trading with the Enemy Act of 1917, 50 U.S.C. app. § 5(b)(1)(B) (1982). Following the entry of the People's Republic of China into the Korean War in 1950, President Truman blocked Chinese and North Korean property within the jurisdiction of the United States. The Management of Blocked Foreign Assets in the United States, 12 INT'L CURRENCY Rzv. 37, 38 (No. 6 1980).......

Words: 21247 - Pages: 85

#### Banker

...CRUS Date: 27 February 2015 Business Summary Sector: Technology Industry: Semiconductors CIRRUS LOGIC INC (NASDAQ STOCK EXCHANGE GLOBAL SELECT MARKET) Cirrus Logic, Inc. (Cirrus Logic) develops analog and mixed-signal integrated circuits (IC) for a broad range of consumer and industrial markets. Building on its diverse analog mixed-signal patent portfolio, Cirrus Logic delivers optimized products for consumer and professional audio, automotive entertainment, and targeted industrial applications, including energy control, energy measurement, light emitting diode (LED) lighting and energy exploration. The Company serves customers in the United States, Europe and Asia, including the People’s Republic of China, Hong Kong, South Korea, Japan, Singapore, Taiwan and the United Kingdom. In October 2013, the Company acquired Acoustic Technologies, Inc. In August 2014, the Company acquired Wolfson Microelectronics plc. Share Performance 29.66 Price (\$): Volume (millions): 1.1 Cirrus Logic Inc 800 WEST 6TH STREET AUSTIN TX 78701 United States Thurman Case (Chief Financial Officer) http://www.cirrus.com P/E: Employees: Market Cap: Shares Outstanding: Float: 42.77 751 (Millions) 52 Week High: 52 Week Low: 30.65 16.80 Currency: USD 1,860.69 62.73 62.43 Sa le s 940 810 680 550 430 300 Ma r 1 2 Ma r 1 3 Ma r 1 4 (\$ Millions) In co m e Financial Summary BRIEF: For the 39 weeks ended 27 December 2014, Cirrus Logic, Inc. revenues increased 17% to \$661.4M.......

Words: 6713 - Pages: 27

#### The Banker Blueprint

...The Banker Blueprint: The Last-Minute Guide to Breaking Into Investment Banking A Production http://breakingintowallstreet.com http://www.mergersandinquisitions.com http://breakingintowallstreet.com http://www.mergersandinquisitions.com Feel free to copy this report and send it to all your friends. Actually, scratch that – please copy this report and send it to all your friends. Forward it to as many people as possible. The more the merrier! Print it out, pass it around, and hand out copies to everyone you know. Just make sure you keep the names and logos on each page intact. Table of Contents Why I Wrote This Guide and What You’re Going to Learn ........................................................... 4 Reality Checks and Beaches in Thailand .......................................................................................... 4 Action Plan, Step 1: Plan Your Strategy ........................................................................................... 6 Your Strategy: Action Steps ........................................................................................................... 9 Action Plan, Step 2: Craft Your Story ............................................................................................. 10 Your Story: Action Steps .............................................................................................................. 14 Action Plan, Step 3: Network Like a Ninja .....................................................

Words: 9377 - Pages: 38

Free Essay

#### The Banker and the Campus Uproar

... The Banker And The Campus Uproar Student’s Name Institutional Affiliation Discussion Questions * Why would a bank consider making a mortgage loan or home equity loan to a homeowner who could not make the scheduled loan payments--wouldn’t this end up hurting the bank? Answer: Before advancing loans to the potential customers the banks consider certain things with the help of documents and tools. The financial position to the best of knowledge is assessed. But there is always a risk of default at the debtor’s end. Therefore, the bank bears the risk. For the minimization of this risk, the banks secure themselves with the help of securities and collaterals. In term of house loans, the house which is for which loan is advanced is taken as the collateral. A charge of bank is created over that asset by the bank. In case of default in payments by the debtor, the bank acquires that house and recovers the money of loan and interest by selling the house in auction. Any residual value after paying the bank liabilities is returned to the debtor. Therefore, throughout the loan tenure, bank is secure and reduces its risk with the help of collaterals. * After considering Cristina’s likely motives, incentives and behavior, do you believe she had conflicts of interest that were so serious she would knowingly recommend loans that were harmful to her clients’ interests? Explain your answer. Answer: The motives of Cristina were own wealth maximization. She was offered benefits on......

Words: 1277 - Pages: 6

#### Protection to Bankers

...Protection to Bankers from disclosure of certain information to public  Banking is one of the most risky sectors as far as privacy is concerned due to the highly sensitive and personal nature of information which is often exchanged, recorded and retained. Although India has RBI guidelines and legislations to protect data, this blog post looks at the extent of those protections, and what are the areas that still need to be addressed. Introduction Banking is one of the most at risk sectors for privacy violations due to the sensitive, and highly personal nature of information that is exchanged, recorded, and retained. Individuals must trust banks with personal identifying information, their financial records, the access information to their accounts,  and their credit history. Thus, privacy violations are not taken lightly and heavily impact the individual whose privacy was violated. Ways in which a violation of privacy can take place in the banking sector include: sharing personal information with third parties without consent  for marketing purposes, stolen or lost banking number or card, sharing personal information or allowing access to third parties without informed consent, inadequate notification  to an individual concerning what will be done with their data, collecting more personal data than is necessary, refusal to provide financial records upon request by client, incorrectly recording personal information, and loss of  a clients personal data due to improper......

Words: 2508 - Pages: 11

#### Bankers More Powerful Than Leaders

...4th and the 5th were occupied by the central bankers Ben Bernanke of the U.S. Federal Reserve, Jean-Claude Trichet of the European Central Bank (ECB) and Masaaki Shirakawa of the Bank of Japan respectively throwing the political leaders of some of the most powerful nations behind them. Why they were considered powerful? Well, the year 2009 has its own prominence from the economic prospective. Recession was at its peak, inflation was making some of the powerful nations of the world shaky, stock markets plummeted and there were many more such economic drawbacks that were evidenced during this year. These slowed down many economies and even were the reasons for the fall of some of the developed nations. Nations were suffering with a deficit in money and assets. Some of the huge scale banks collapsed. Almost all of the sectors got affected. Even some famous companies went bankrupt. The economic policies run by the political leaders run on the wheels of the policing by the bankers. In the world that existed before the financial crisis, central bankers were triumphant. They had defeated inflation and tamed the business cycle. And they had developed a powerful intellectual consensus on how to do their job, summarized recently by David Blanch flower, a member of the Bank of England’s monetary policy committee, as “one tool, one target”. The tool was the short-term interest rate, the target was price stability. So central bankers play a major role in reconciling the......

Words: 689 - Pages: 3

#### Goldsmith Bankers

...FUNCTIONS OF THE GOLDSMITH BANKERS The first recorded history of banks was during ancient Roman and Greek Empires, where the temple priests would store gold and silver for safekeeping. Coins were brought to the temples not only as offerings but also for the payment of taxes. Since the temple was a place of worship and was always guarded, it was also considered a safe and secure place for storing items of value. The temples also lent money to the locals for trading purposes and exchanged foreign coins for local coins. During the medieval period, modern banking first began in Italy and then in Holland where banks facilitated the growing trade between Europe and far East. (Wikipedia: History of Banking). In areas where formal banking systems had not yet been established, goldsmiths were performing the necessary money lending and exchange transactions (Black, reading 4-3, p.2). The number of goldsmith-bankers in London has been estimated at 32 in 1670, 44 in 1677, and 42 in 1700(Goldsmith-Banking: Mutual Acceptance and Interbank Clearing in Restoration London. Quinn, Stephen). Edward Backwell was one of the many goldsmith bankers who had established a network of money lending business in London. Along with selling and trading precious metal jewellery and articles, he accepted deposits of gold from merchants for safekeeping; paid interest on the deposits; lent money on interest to the Government and the overseas trading companies; and exchanged foreign coinage (Black,......

Words: 1300 - Pages: 6