PAL Reading Notes

Source: Internet
Author: User
Document directory
  • 1. PAL-specific Entry Points
  • 2. File System
  • 3. Memory Management
  • 4. synchronous/asynchronous IO
  • Threading
  • Networking
  • Exception
  • CRT (C Runtime)
  • Postscript:

PAL = Platform Abstract Layer, which is the dependency of the. Net Platform on the specific operating system level, mainly including

  1. Start and end
  2. File System
  3. Memory Management
  4. Synchronous I/O
  5. Asynchronous I/O
  6. Threading
  7. Networking
  8. Exception Handling
  9. Debugging support
  10. CRT (C Runtime Library)
1. PAL-specific Entry Points

The so-called PAL-specific Entry Points refers to the interface defined by the PAL layer, such as start and end. It includes the following methods:

Method Name Explanation
PAL_Initialize
  1. 0 is returned when the call is successful, and other values are returned when the call fails. It is best to prompt the error message.
  2. PAL needs to provide the exit and ExitProcess Methods
  3. CreateThread method to create a process
PAL_Terminate
  1. If PAL_Initialize is successful, execute PAL_Terminate.
  2. After the PAL_Terminate call is complete, if the PAL client is less than 0, it will jump to exit and ExitProcess
PAL_GetUserConfigurationDirectoryW Returns the Setting data of the corresponding user.
  • PAL_RegisterLibrary
  • PAL_UnregisterLibrary
  • Register the lib dll file (lpLibFileName) in DLLMain)
    PAL_GetPALDirectoryW Obtain the directory where the PAL dll runs. For example, c: \ Rotor \ v1.x86chk. rotor \ rotor_pal.dll returns c: \ Rotor \ v1.x86chk. rotor
    PAL_Random Random Number Generation. 1. lpBuffer: used to obtain random bytes. 2. bStrong: used to identify random numbers with additional strength, for example, Key
    PAL_get_stdout/PAL_get_stdin/PAL_get_stderr Corresponding stdout, stdin, and stderr methods of the system
    PAL_errno Returns a pointer to the corresponding thread error code.
    PAL_LocalHandleToRemote/PAL_RemoteHandleToLocal
  • Pointer to mutex, process, and event
  • Returned value: INVALID_HANDLE_VALUE/Handle value or Type
  • 2. File System

    Taking the PAL layer of a UNIX system as an example, there are five types of operations on the file system.

    1. File Operations
    2. Operations on directories
    3. Read disk Information
      PALIMPORT BOOL PALAPI GetDiskFreeSpaceW(          LPCWSTR lpDirectoryName,          LPDWORD lpSectorsPerCluster,          LPDWORD lpBytesPerSector,          LPDWORD lpNumberOfFreeClusters,  /* Caller will ignore output value */          LPDWORD lpTotalNumberOfClusters) /* Caller will ignore output value */
    4. Search for files
    5. Path operations

    3. Memory Management

    Local: Local Memory Management Heap: Heap-based memory management shared memory: the so-called shared memory means that different processes use the same copy. For example, program B uses. dll, and C is also, so B and C have shared memory. the shared memory also contains the copy-on-write and synchronization parts.

    4. synchronous/asynchronous IO

    Debug

    Threading
    Code name Function
    Process. h Process operations
    Thread. h Thread operations
    Localstorage. c Some basic operations of string, such as contact and copy
    Seamphore. c Semaphores
    Mutex. c Mutex
    Event. h/event. c Event
    Critsect. c CRITICAL_SECTION
    Wait. c  
    Networking

    Soket Communication Mechanism

    Asynchronous Communication: Async. c

    Exception

    SEH-Structure ubuntuin Handler

    CRT (C Runtime)
    Code name Function
    File. c Operations on files, basic operations on files in C Language
    Finite. h Support for floating point numbers, infinity, and infinity
    Lstr Some basic operations of string, such as contact and copy
    Mbstring. c Multi-bytes string
    Misc. c Interaction with the running environment, such as char * MiscGetenv (const char * name)
    Path. c Path operations
    Printf. c Corresponding OS output
    Silent_printf.c Corresponding Trace Output TODO: Verify this
    String. c Common Operations corresponding to string, comare, _ swab, PAL_strtoul, PAL_atol...
    Thread. c PAL_exit
    Wchar. c Contains operations on char and string.
    Postscript:

    What involves the PAL level naturally involves a lot of operating system knowledge. Due to the concentration of knowledge and the limitations of personal energy, a detailed explanation is not provided for the time being. If you are interested and competent, thank you for your advice. Thank you.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.