Consider the following proposed solution for the critical section problem. There are n processes: P0…Pn – 1. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero. Code for Pi: do {                 c [i]=1; t[i] = pmax (t [0],…, t[n-1]) +1; c[i]=0;                 for every j ≠ I in {0,…,n-1} {                                 while (c[j]);                                 while (t[j] != 0 && t[j]<=t[i]) ;                 ]                 Critical section;                 t[i] =0;                 Remainder Section; } While (true); Which one of the following is TRUE about the above solution?

Consider the following proposed solution for the critical section problem. There are n processes: P0…Pn – 1. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero. Code for Pi: do {                 c [i]=1; t[i] = pmax (t [0],…, t[n-1]) +1; c[i]=0;                 for every j ≠ I in {0,…,n-1} {                                 while (c[j]);                                 while (t[j] != 0 && t[j]<=t[i]) ;                 ]                 Critical section;                 t[i] =0;                 Remainder Section; } While (true); Which one of the following is TRUE about the above solution? Correct Answer At most one process can be in the critical section at any time

Given code is a N process synchronization solution (known as Lamport’s bakery algorithm)

; c=0;

This helps in getting the token. Each process which wants to enter into critical section, gets a token number (as in a restaurant) and wait for his turn.

c=1 //announce that process Pi is ready to take it’s token number

t = pmax (t ,…, t) +1 //get token number

c=0; // means process Pi has taken it’s token number

As more than one process can get same token value and then suppose P2 wants to enter the critical section. So, this line will be executed

while (t != 0 && t<=t) ;

Now, j!=i, P2 scans for other processes and check if anyone of them have it’s token value less than or equal to it’s own token value. When P2 finds true then it starts looping at the condition. Similar for other processes. So, when P1 ­finds that all other processes have their token value as non zero and have value less than token of P1. It also waits. It becomes the situation of deadlock.

When deadlock in the system, progress will not be satisfied here.

Also, when a process reaches critical section, all other processes which started before it must have its token value as 0. This means that no two processes can be in critical section at the same time.

Related Questions

The question given below consists of a statement, followed by three arguments numbered I, II and III. You have to decide which of the arguments is/are ‘strong’ arguments and which is/are ‘weak’ arguments and accordingly choose your answer from the alternatives given below each question. Statement: A shortage of bank branches and ATMs across India’s hinterland is holding back Prime Minister Narendra Modi’s financial inclusion efforts and risks angering rural voters ahead of elections next year. After taking office in 2014, Modi set an ambitious target to open a bank account for every household to ensure welfare funds flow directly to India’s poor, while improving access to credit and insurance programs. He pushed policies that helped bring 310 million people into the formal banking system in just four years, according to the World Bank. Based on the arguments stated below and he information stated above, which of the following arguments state the reason for the problem, ‘But many of India’s villages still lack bank branches or ATMs to help service new customers, while the pace of building new financial infrastructure has actually slowed’.  Arguments: I. Because Modi’s government effectively forced poor citizens into the banking system by linking some welfare benefits to bank accounts, villagers have ended up stuck in long queues and struggling with ATMs that often run out of cash or break down.  II. With an election due next year, the mismatch between the government’s policies and the rural banking system is generating frustration among a key slice of India’s electorate. III. The banking system struggled to keep up, while some gains proved temporary. Nearly half of Indian bank accounts were inactive in 2017, meaning they weren’t used at all in the previous 12 months
The question given below consists of a statement, followed by three arguments I, II and III. You have to decide which of the arguments is/are ‘strong’ arguments is/are ‘weak’ arguments and accordingly choose your answer from the alternatives given below each question. Statement: Chat bots and other interfaces are saving employees and HR heads time for more productive activities by providing information and replies to diverse queries or concerns. A few years ago, business communication was driven by multiple faxes in a day and emails were the only quick mode of exchanging information. This information went through the organisation's who's who, while the others were mostly engaged in the daily rut of redundant activities, preventing them from directing their capabilities towards more productive areas. Which of the following arguments brig out the idea that introduction of chat bots and other interfaces is not helping in boosting up the processes? Arguments: I. Using these conversational interfaces, HR departments are successfully aligning themselves with the swiftly-changing organisational processes. These platforms represent people friendly technologies that keep employee experience at the centre, continuously evolving with them.  II. HR technologies are increasingly using advanced machine learning for measuring and analysing workforce engagement. Sentiment analysis is a unique way of gauging an employee's disposition towards the organisation, providing valuable insights essential for improving productivity and predicting attrition rates.  III. The seamless experience chat bots provide makes employees focus on activities that require critical abilities and strategic thinking. Besides enabling HR processes such as generating leave applications and reimbursement forms, the use of chatbots provides quick and smooth access to data from anywhere, anytime. 
The question given below consists of a statement, followed by three arguments I, II and III. You have to decide which of the arguments is/are ‘strong’ arguments is/are ‘weak’ arguments and accordingly choose your answer from the alternatives given below each question. Statement: India's burgeoning shadow finance sector is likely to face a shake-up after defaults at one major lender battered the nation's financial markets in the past week and reinforced worries about credit risk. Industry officials and experts say they expect Indian regulators to cancel the licences of as many as 1,500 smaller non-banking finance companies because they don't have adequate capital, and to also make it more difficult for new applicants to get approval. Which of the following argument(s) stated support(s) the given fact? Arguments: I. Better capitalised and more conservatively run finance firms are likely to swallow up an increasing number of smaller rivals. That could make it difficult for many small borrowers to get loans, especially in the countryside where two-thirds of India's 1.3 billion people live and put the brakes on a surge in private consumption with a knock-on effect on growth.  II. The shadow banking sector now comprises more than 11,400 firms with a combined balance-sheet worth 22.1 trillion rupees ($304 billion) and is less strictly regulated than banks. It has been attracting new investors, particularly as the nation's banks have had to slow their lending as they seek to work through $150 billion of stressed assets.  III. Nearly 11,000 of India's NBFCs are small and medium-sized businesses with an asset base of less than 5 billion rupees. But the top 400, many of which are backed by banks and finance companies, control about 90 percent of the assets under management.
The question given below consists of a statement, followed by three arguments numbered I, II and III. You have to decide which of the arguments is/are ‘strong’ arguments and which is/are ‘weak’ arguments and accordingly choose your answer from the alternatives given below each question. Statement: World’s largest beer maker Heineken NV, the majority partner of United Breweries with Vijay Mallya, is understood to have sought legal opinion over its right to appoint a chairman at the Indian company. Heineken and some of its advisers believe that the shareholder agreement between Mallya and the beer giant has become null and void after India’s Enforcement Directorate attached his shares as part of its legal action against the liquor baron. Which among the following arguments support the above statement in the best possible manner? Arguments: I. UBL has stopped sharing confidential information with Mallya and has said that he is no longer privy to any strategic developments.  II. The board of UBL, India’s biggest beer company, had asked Mallya to either step down or appoint a nominee after the Securities and Exchange Board of India barred wilful defaulters from holding key board positions last year.  III. The company is functioning well and operations are in good shape but it is not good corporate governance to have an acting chairman for so long.
The question given below consists of a statement, followed by three arguments I, II and III. You have to decide which of the arguments is/are ‘strong’ arguments is/are ‘weak’ arguments and accordingly choose your answer from the alternatives given below each question. Statement: The domestic equity market has become supervolatile  and converted the psychology of every market participant into fear. Greed and fear continue to alternate in the market, like the two sides of a coin. To a seasoned player, there seems to be nothing new as such instances of panic-selling often occur time and again. Why? Arguments: I. Since demonetisation, herd mentality had jacked up financials, banks and NBFC stocks to great heights on the pretext of financial inclusion and formalisation of the economy. This caused the financials gain disproportionate share in Nifty50 at 35 per cent of the free float market capitalisation, which was unheard of in the past.  II. The domestic market seems to be deeply oversold and can rebound on any good news. The Nifty50 has taken long-term support at the three-year trend line, which makes a case for the correction to near its end. III. Investors, therefore, should not panic and sell off shares. Instead they should do the reverse and gather the courage to pump in more money into the market by picking quality stocks or investing in ETFs for more stable returns.