Segmented architecture is an important part of the OS/2 memory-protection scheme. In a “multitasking” operating system where numerous programs can run simultaneously, programs must not access the code and data of another process without permission.
In DOS, the data and code segments are usually allocated adjacent to each other, as shown in Figure 1.1. In OS/2, the data and code segments may be anywhere in memory. The programmer knows nothing about their location and has no control over it. The segments may even be moved to a new memory location or swapped to disk while the program is running.
Summary: Segment protection prevents a bug in one program from corrupting another program.
Segment protection makes software development easier and more reliable in OS/2 than in DOS because, in OS/2, any illegal access is detected immediately. The operating system intercepts illegal memory accesses, terminates the program, and displays a message. This makes the bug easier to track down and fix.
In DOS, an illegal access is not detected and may not cause an error until later, when another part of the program attempts to use the corrupted memory.