理解Computer中slack space||page cache||thrashing||file descriptor

    技术2022-07-10  77

    File descriptor

    Wikipedia

    In Unix and related computer OS, a file descriptor(FD, less frequently fildes) is an abstract indicator(handle) used to access a file or other Input/Output resource, such as a pipe or network socket.

    A file descriptor is a non-negative integer, generally represented in the C programming language as the type int, each Unix process should expect to have three standard POSIX file descripotrs, corresponding to the three standard streams:

    Integer valueName<[unistd.h]> symbolic constant<[stdio.h]>file stream0Standard inputSTDIN_FILENOstdin1Standard outputSTDOUT_FILENOstdout2Standard errorSTDERR_FILENOstderr

    slack space

    Redirect to fragmentation, which is a phenomenon in which storage space is used inefficiently, reducing capacity or performance and often both.

    There are three differnet but related forms of fragmentation:

    external fragmentationinternal fragmentationdata fragmentation

    page cache

    wikipedia

    In computing, a page cache(alse called disk cache) is a transparent cache for the pages originating from a secondary storage device such as a hard disk drive(HDD) or a solid-state drive(SSD).

    The OS keeps a page cache in otherwise unused portions of the main memory(RAM), resulting in quicker access to the contents of cached pages and overall performance improvements.

    A page cache is implemented in kernels with the paging memory management, and is mostly transparent to applications.

    Usually, all physical memory not directly allocated to applications is used by the operating system for the page cache.

    Since the memory would otherwise be idle and is easily reclaimed when applications request it, there is generally no associated performance penalty and the OS might even report such memory as “free” or “available”.

    thrashing

    Wikipedia

    In computer science, thrashing occurs when a computer’s virtual memory resources are overused, leading to a constant state of paging and page faults, inhibiting most application-level processing.

    This causes the performance of the computer to degrade or collapse.

    The situation can continue indefinitely until either the user closes some running applications or the active processes free up additional virtual memory resources.

    The term is also used for various similar phenomena, where a process progresses slowly because significant time is being spent acquiring resources.

    Virtual memory works by treating a portion of secondary storage such as an additional layer of the cache hierarchy.

    Virtual memory is notable for allowing processes to use more memory than is physically present in main memory and for enabling virtual machines.

    In effect, physical main memory becomes a cache for virtual memory which is in general stored on disk in memory pages.

    Processed: 0.015, SQL: 9