Question
Which design pattern is most suitable for controlling
access to a resource by limiting the number of clients that can use it concurrently?Solution
The Proxy Pattern is a structural design pattern used to control access to resources by acting as an intermediary or placeholder. It can implement restrictions like access control, caching, or logging. In the context of concurrency, the proxy ensures that only a limited number of clients access a resource at a time. For example, a proxy server can manage a pool of database connections, granting access to clients based on availability. This pattern reduces resource contention and improves system scalability and security. By isolating the resource, the Proxy Pattern adds flexibility and control over its usage. Why Other Options Are Incorrect :
- Singleton Pattern : Ensures a single instance of a class but does not control concurrent access.
- Factory Pattern : Focuses on object creation, unrelated to access control.
- Decorator Pattern : Enhances object functionality dynamically but does not manage access.
- Flyweight Pattern : Shares objects to save memory, not for controlling resource access.
- A person invested Rs. 30,000 in two schemes. One scheme gives a simple interest of 7% p.a., while the other scheme gives 11% p.a. If the total interest ear...
A man invested a certain amount of sum at 12.5% per annum simple interest and earned an interest of Rs.2400 after 4 years. If the same amount is investe...
Simple interest received at the rate of 15% p.a. for 2 years on a principal amount of Rs. 9000 is twice of the simple interest received at 10% p.a. for ...
A sum of money amounts to Rs 5400 in 3 years and to Rs 6000 in 5 years at simple interest. Find the principal and the rate of interest per annum.
A man invested certain sum at simple interest of r% p.a. such that it amounts to 130% of itself in 3 years. Find the interest earned when Rs. 3000 is in...
- An amount was invested at a simple interest rate. After 6 years, it amounted to (126/108) times the amount it had reached in 4 years. What is the rate of i...
An amount of 'a' is invested at an annual interest rate of 18% with simple interest, and another amount of 'a + 750' is invested at an annual interest...
A man invested certain sum at 10% p.a. simple interest for his son who was 17 years old. If the amount received by the son when he was 30 years old is R...
Arjun borrowed Rs. 5000 at R% S.I. and Rs. 6000 at (R + 5)% S.I. for 2 years. The total interest paid was Rs. 2800. Find the rate at which he borrowed R...
A sum of Rs. 3200 is invested at simple interest for 2 years. If the rate interest for first year is 12% p.a. while 20% p.a. for second year, then find ...