The database server allocates an area in the virtual portion of shared memory to store nonshared data for the functions that a thread executes. This area is called the stack.

For information about how to set the size of the stack, see Stacks.

The stack enables a virtual processor to protect the nonshared data of a thread from being overwritten by other threads that concurrently execute the same code. For example, if several client applications concurrently perform SELECT statements, the session threads for each client execute many of the same functions in the code. If a thread did not have a private stack, one thread might overwrite local data that belongs to another thread within a function.

When a virtual processor switches to a new thread, it loads a stack pointer for that thread from a field in the thread-control block. The stack pointer stores the beginning address of the stack. The virtual processor can then specify offsets to the beginning address to access data within the stack. The figure illustrates how a virtual processor uses the stack to segregate nonshared data for session threads.
Figure 1. Virtual processors segregate nonshared data for each user
The paragraph that precedes this figure describes the content of the figure.

Copyright© 2020 HCL Technologies Limited