Operating systems have limited direct execution to maintain control over resource permissions and process operations.User programs run in user mode by default and issue system calls to perform restricted operations.The operating system has a trap table that maps system calls to instructions, and writing to it is a restricted operation.Context switching involves saving the registers of the currently executing process and restoring those of the soon-to-be-executing process.