hard
Single Answer
0Annie wants to prevent a TOC/TOU issue that occurs with her organization's business application. The issue occurs when scripts run as part of the application access a shared data file. Sometimes one instance of the script opens the file, checks that inventory is sufficient to meet customer needs, then waits for the customer's interaction. At the same time, another instance of the script checks, sees that there is sufficient inventory, and also provides that information to another customer. If both customers place orders, Annie's organization is unable to meet demand. If Annie wants to continue to grow her business's use of the application, which of the following options is the best way to prevent this issue?
Answer Options
A
Delete the resource after each use.
B
Only run one instance of the process.
C
Make multiple copies of the resource so each process has its own.
D
Lock the resource until the process is done with it.
Correct Answer: D
Explanation
Locking the resource until the action is completed is a common method of preventing TOC/TOU issues. Deleting the resource after each use doesn't allow resources to be persistent, preventing applications from using them on an ongoing basis. Running a single instance of the process will heavily limit the ability for Annie's business to scale the service. Making multiple copies doesn't allow for a shared resource.