Questions about Remote Segments - Minix

This is a discussion on Questions about Remote Segments - Minix ; Hi! Looking into the proc structure I found there are segments besides CS and DS, they are called "remote (memory) segments". The comments in the source code were no help, but I found in the Thesis from Herder that these ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Questions about Remote Segments

  1. Questions about Remote Segments

    Hi!

    Looking into the proc structure I found
    there are segments besides CS and DS,
    they are called "remote (memory) segments".
    The comments in the source code were no
    help, but I found in the Thesis from Herder
    that these segments could be located on/in
    RAM disk, video memory, etc.
    If this is correct, why there are 3 used
    in general? (maybe this is connected to
    the next question)
    How is the "variable" in this comment meant?
    #define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
    (const.h:46)
    What are common uses for remote segments?


    thx in advance
    Bernhard

  2. Re: Questions about Remote Segments

    > there are segments besides CS and DS,
    > they are called "remote (memory) segments".
    > ...
    > How is the "variable" in this comment meant?
    > #define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
    > (const.h:46)
    > What are common uses for remote segments?


    MINIX 3 makes a distinction between local segments (program text, stack,
    data) and remote segments (e.g., RAM disk memory, video memory, etc.).
    This distinction was made because all processes need local segments, but
    ordinary user programs are not allowed to have remote segments, which are
    only available to the system processes.

    In theory, all segments could have been declared in the process table
    (proc.h), but since remote segments are only available to system
    processes, the remote segments are declared in the privilege structure
    (priv.h). Currently, the memory driver uses a maximum of 3 segments, which
    explains the NR_REMOTE_SEGS definition.

    Jorrit

  3. Re: Questions about Remote Segments



    > In theory, all segments could have been declared in the process table
    > (proc.h), but since remote segments are only available to system
    > processes, the remote segments are declared in the privilege structure
    > (priv.h). Currently, the memory driver uses a maximum of 3 segments,
    > which explains the NR_REMOTE_SEGS definition.


    thx for the answer, but it seems to me
    that the actual 3.1.1 source contains some
    "incoherence", because in proc.h, there is "space"
    for remote segments in the p_ldt struct:

    struct proc
    {
    ....
    struct segdesc_s p_ldt[2+NR_REMOTE_SEGS];
    ....
    }
    and in priv.h there is also "space" in s_farmem:
    struct priv
    {
    ....
    struct far_mem s_farmem[NR_REMOTE_SEGS]; /* remote memory map */
    ....
    }

    If I understand it, than the p_ldt in proc should
    be only of the size 2 not 5 (2+RemoteSegs) right?
    Because with the current proc struct, every process
    would have CS, DS + 3 Remote Segments and a system
    process would have an additional 3 Remote Segments, right?

    Bernhard

  4. Re: Questions about Remote Segments

    > there is "space" for remote segments in the p_ldt struct:
    > ...
    > and in priv.h there is also "space" in s_farmem:
    > ...
    > If I understand it, than the p_ldt in proc should
    > be only of the size 2 not 5 (2+RemoteSegs) right?
    > Because with the current proc struct, every process
    > would have CS, DS + 3 Remote Segments and a system
    > process would have an additional 3 Remote Segments, right?


    The field p_ldt in struct proc is the local descriptor table (LDT) that's
    used by the CPU. Since there is only one LDT per process, both the local
    and remote segments must be included. Recall that local segments can be
    Text, Stack, or Data, but the Stack/Data is treated as a single segment in
    the LDT to make sure C-pointers work for both the stack and data segment.

    You're right about the double administration for remote segments. Note
    that there is double administration for local segments as well (see the
    field p_memmap in struct proc).

    The p_memmap and s_farmem fields are currently used for virtual copy
    calls, and not the p_ldt struct. I don't know all code relying on these
    fields by heart, but perhaps the double bookkeeping can be removed (by
    using p_ldt instead) to save some memory for the kernel.

    Jorrit

+ Reply to Thread