Page 254 - DCAP103_Principle of operating system
P. 254

Unit 7: Secondary Storage Structure



            device  (primary  swap)  must  be  present  on  the  system.  During  system  startup,  the  location   Notes
            (disk block number) and size of each swap device is displayed in 512 KB blocks. The swapper
            reserves swap space at process creation time, but does not allocate swap space from the disk
            until pages need to go out to disk. Reserving swap at process creation protects the swapper
            from running out of swap space. You can add or remove swap as needed (that is, dynamically)
            while the system is running, without having to regenerate the kernel. HP-UX uses both physical
            and pseudo swap to enable efficient execution of programs.
            7.6.1 Pseudo-Swap Space

            System memory used for swap space is called pseudo-swap space. It allows users to execute
            processes in memory without allocating physical swap. Pseudo-swap is controlled by an
            operating-system  parameter;  by  default,  swapmem  on  is  set  to  1,  enabling  pseudo-swap.
            Typically, when the system executes a process, swap space is reserved for the entire process, in
            case it must be paged out. According to this model, to run one gigabyte of processes, the system
            would have to have one gigabyte of configured swap space. Although this protects the system
            from running out of swap space, disk space reserved for swap is under-utilized if minimal or
            no swapping occurs.
            To avoid such waste of resources, HP-UX is configured to access up to three-quarters of system
            memory capacity as pseudo-swap. This means that system memory serves two functions: as
            process-execution space and as swap space. By using pseudo-swap space, a one-gigabyte memory
            system with one-gigabyte of swap can run up to 1.75 GB of processes. As before, if a process
            attempts to grow or be created beyond this extended threshold, it will fail. When using pseudo
            swap for swap, the pages are locked; as the amount of pseudo-swap increases, the amount of
            lockable memory decreases.
            For factory-floor systems (such as controllers), which perform best when the entire application is
            resident in memory, pseudo-swap space can be used to enhance performance: you can either lock
            the application in memory or make sure the total number of processes created does not exceed
            three-quarters of system memory. Pseudo-swap space is set to a maximum of three-quarters of
            system memory because the system can begin paging once three-quarters of system available
            memory has been used. The unused quarter of memory allows a buffer between the system and
            the swapper to give the system computational flexibility. When the number of processes created
            approaches capacity, the system might exhibit thrashing and a decrease in system response time.
            If necessary, you can disable pseudo-swap space by setting the tunable parameter swapmem
            on in /usr/conf/master.d/core-hpux to zero. At the head of a doubly linked list of regions that
            have pseudo-swap allocated is a null terminated list called pswaplist.
            7.6.2 Physical Swap Space

            There are two kinds of physical swap space—device swap and file-system swap.

            7.6.2.1 Device Swap Space

            Device swap space resides in its own reserved area (an entire disk or logical volume of an LVM
            disk) and is faster than file-system swap because the system can write an entire request (256
            KB) to a device at once.

            7.6.2.2 File-system Swap Space

            File-system swap space is located on a mounted file system and can vary in size with the
            system’s swapping activity. However, its throughput is slower than device swap, because
            free file-system blocks may not always be contiguous; therefore, separate read/write requests



                                             LOVELY PROFESSIONAL UNIVERSITY                                   247
   249   250   251   252   253   254   255   256   257   258   259