0% found this document useful (0 votes)
33 views

General Protection Fault: Virtual Memory

- Virtual memory allows operating systems to make memory appear as one continuous chunk even though it is scattered across RAM and disk, through techniques like paging and segmentation. This allows memory to be shared between multiple tasks. - When a program tries to access memory not currently allocated to it, the kernel interrupts it through a page fault. The kernel then adjusts the program's memory range to grant it access. - Multitasking gives the appearance that multiple programs run simultaneously by rapidly switching the CPU between them. In reality most computers can only execute one program at a time.

Uploaded by

Vishnu Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

General Protection Fault: Virtual Memory

- Virtual memory allows operating systems to make memory appear as one continuous chunk even though it is scattered across RAM and disk, through techniques like paging and segmentation. This allows memory to be shared between multiple tasks. - When a program tries to access memory not currently allocated to it, the kernel interrupts it through a page fault. The kernel then adjusts the program's memory range to grant it access. - Multitasking gives the appearance that multiple programs run simultaneously by rapidly switching the CPU between them. In reality most computers can only execute one program at a time.

Uploaded by

Vishnu Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

rror.

Windows versions 3.1 through ME had some level of memory protection, but programs could
easily circumvent the need to use it. A general protection fault would be produced, indicating a
segmentation violation had occurred; however, the system would often crash anyway.
Virtual memory
Main article: Virtual memory
Further information: Page fault

Many operating systems can "trick" programs into using memory scattered around the hard disk and RAM
as if it is one continuous chunk of memory, called virtual memory.

The use of virtual memory addressing (such as paging or segmentation) means that the kernel
can choose what memory each program may use at any given time, allowing the operating
system to use the same memory locations for multiple tasks.
If a program tries to access memory that isn't in its current range of accessible memory, but
nonetheless has been allocated to it, the kernel is interrupted in the same way as it would if the
program were to exceed its allocated memory. (See section on memory management.) Under
UNIX this kind of interrupt is referred to as a page fault.
When the kernel detects a page fault it generally adjusts the virtual memory range of the program
which triggered it, granting it access to the memory requested. This gives the kernel discretionary
power over where a particular application's memory is stored, or even whether or not it has
actually been allocated yet.
In modern operating systems, memory which is accessed less frequently can be temporarily
stored on disk or other media to make that space available for use by other programs. This is
called swapping, as an area of memory can be used by multiple programs, and what that
memory area contains can be swapped or exchanged on demand.
"Virtual memory" provides the programmer or the user with the perception that there is a much
larger amount of RAM in the computer than is really there. [35]
Multitasking
This section does not cite any sources. Please help improve this
section by adding citations to reliable sources. Unsourced material
may be challenged and removed. (December 2018) (Learn how and
when to remove this template message)
Main articles: Computer multitasking and Process management (computing)
Further information: Context switch, Preemptive multitasking, and Cooperative multitasking
Multitasking refers to the running of multiple independent computer programs on the same
computer; giving the appearance that it is performing the tasks at the same time. Since most
computers can do at most one or two things at one time, this is generally done via time-sharing,
which means that each program uses a share of the computer's time to execute.
An operating system kernel contains a scheduling program which determines how much time
each process spends executing, and in which order execution control should be passed to
programs. Control is passed to a process by the kernel, which allows the program access to
the CPU and memory. Later, control is returned to the kernel through some mechanism, so that
another program may be allowed to use the CPU. This so-called passing of control between the
kernel and applications is called a context switch.
An early model which governed the allocation of time to programs was called cooperative
multitasking. In this model, when control is passed to a program by the kernel, it may execute for
as long as it wants before explicitly returning control to the kernel. This means that a malicious or
malfunctioning program may not only prevent any other programs from using the CPU, but it can
hang the entire system if it enters an infinite loop.

rror.
Windows versions 3.1 through ME had some level of memory protection, but programs could
easily circumvent the need to use it. A general protection fault would be produced, indicating a
segmentation violation had occurred; however, the system would often crash anyway.
Virtual memory
Main article: Virtual memory
Further information: Page fault
Many operating systems can "trick" programs into using memory scattered around the hard disk and RAM
as if it is one continuous chunk of memory, called virtual memory.

The use of virtual memory addressing (such as paging or segmentation) means that the kernel
can choose what memory each program may use at any given time, allowing the operating
system to use the same memory locations for multiple tasks.
If a program tries to access memory that isn't in its current range of accessible memory, but
nonetheless has been allocated to it, the kernel is interrupted in the same way as it would if the
program were to exceed its allocated memory. (See section on memory management.) Under
UNIX this kind of interrupt is referred to as a page fault.
When the kernel detects a page fault it generally adjusts the virtual memory range of the program
which triggered it, granting it access to the memory requested. This gives the kernel discretionary
power over where a particular application's memory is stored, or even whether or not it has
actually been allocated yet.
In modern operating systems, memory which is accessed less frequently can be temporarily
stored on disk or other media to make that space available for use by other programs. This is
called swapping, as an area of memory can be used by multiple programs, and what that
memory area contains can be swapped or exchanged on demand.
"Virtual memory" provides the programmer or the user with the perception that there is a much
larger amount of RAM in the computer than is really there. [35]
Multitasking
This section does not cite any sources. Please help improve this
section by adding citations to reliable sources. Unsourced material
may be challenged and removed. (December 2018) (Learn how and
when to remove this template message)
Main articles: Computer multitasking and Process management (computing)
Further information: Context switch, Preemptive multitasking, and Cooperative multitasking
Multitasking refers to the running of multiple independent computer programs on the same
computer; giving the appearance that it is performing the tasks at the same time. Since most
computers can do at most one or two things at one time, this is generally done via time-sharing,
which means that each program uses a share of the computer's time to execute.
An operating system kernel contains a scheduling program which determines how much time
each process spends executing, and in which order execution control should be passed to
programs. Control is passed to a process by the kernel, which allows the program access to
the CPU and memory. Later, control is returned to the kernel through some mechanism, so that
another program may be allowed to use the CPU. This so-called passing of control between the
kernel and applications is called a context switch.
An early model which governed the allocation of time to programs was called cooperative
multitasking. In this model, when control is passed to a program by the kernel, it may execute for
as long as it wants before explicitly returning control to the kernel. This means that a malicious or
malfunctioning program may not only prevent any other programs from using the CPU, but it can
hang the entire system if it enters an infinite loop.

You might also like