2.1.4 Loading and Executing a Program

  • Process for Loading a Program into memory and executing it
    1. The operating system (OS) searches for the program’s filename in the current disk directory.
    2. If it cannot find the name there, it searches a predetermined list of directories (called paths) for the filename. If the OS fails to find the program filename, it issues an error message.
    3.  If the program file is found, the OS retrieves basic information about the program’s file from the disk directory, including the file size and its physical location on the disk drive.
    4. The OS determines the next available location in memory and loads the program file into memory. It allocates a block of memory to the program and enters information about the program’s size and location into a table sometimes called a descriptor table). Additionally, the OS may adjust the values of pointers within the program so they contain addresses of program data.
    5. The OS begins execution of the program’s first machine instruction (its entry point). As soon as the program begins running, it is called a process. The OS assigns the process an identification number (process ID), which is used to keep track of it while running.
    6. The process runs by itself. It is the OS’s job to track the execution of the process and to respond to requests for system resources. Examples of resources are memory, disk files, and input-output devices.
    7. When the process ends, it is removed from memory

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s