Linux system calls on Windows



  • I know, old computers give me a nerd boner. However, never again. Way to be a trend-setter blakey!


  • Garbage Person

    I vaguely recall there was a beige era Mac that had a black case.


  • Garbage Person

    Power Mac 5500/275 in Europe. I swear there was one in the US....


  • Garbage Person

    Performa 5420CD and Macintosh TV.
    I swear to God there was one that wasn't an all-in-one, though.



  • DISCOOOOOOOOOOOOOOOOOOURSE!

    Then, if I mouse over your post, anywhere, not even just the code block,

    Which fades after a delay after I move my mouse off.

    WHY!?



  • First off, for a garbage collected language, you generally want to set a runtime limit at the start of the program in any case, unless you are using a generational algorithm that allocates whole new generation spaces dynamically - which I don't recommend unless you know you will need to. For the basic GC algorithms (mark-sweep, mark-compact, semi-space compact, or lazy reference counting), you generally want to allocate a fairly large work space at the start and allocate from that within your active space, and then either have that as a hard size limit, or else only reallocate if the whole active space is filled. Allocating individual elements really doesn't work with GC, though you can use eager ref counting instead of GC if you are certain no cycles will form (or you are willing to periodically run a cycle breaker).

    Second, you have to keep in mind that your process(es) won't be alone in memory. You cannot rely on have anywhere near the full address space, especially if it 32-bit (since a 64-bit process is usually no more than double the size of a 64-bit process, and usually quite a bit less, the percentage of the address space used by equivalent system and applications will be proportionally much less on a 64-bit system). This is unlikely to be a real problem, though, really; with current generation software, any single process that requires more that 2GiB of RAM running on a desktop system is Doing It Wrong™ (though the size of a 'reasonable' program does tend to increase as the years pass and memories get larger).

    Third, in the Linux code, you are using the C API, rather than direct system calls, correct? I assume you would prefer the Windows equivalents of the standard userland functions rather than having to handle syscall() directly (though IIUC, that itself is just a wrapper around a SYSENTER operation, or SYSCALL on 64-bit systems), in which case you want to look at the Win32 API libraries rather than the NT Native API or direct system calls.

    Fourth, are you going to continue using GAS under Windows (which would require MinGW or Cygwin anyway, IIUC), or are you going to re-write the code for an Intel syntax assembler, and if so, which one? The specific assembler may have a suitable library bundled with it, or have one available for download.

    Finally, I would try to get a good resource on both the API and assembler you mean to target, and a book on GC; for the latter, I recommend *The Garbage Collection Handbook.

    Win32 Programming for x86 Assembly Language Programmers
    OSdev Wiki: Sysenter
    Windows Dev Center: API Index
    MSFT: Memory Management
    MSFT: Console functions (you didn't say what kind of UI this would have, but you'll probably have any easier time writing test harnesses that use the console, at least at first)
    MSFT: ReadFile
    MSFT: WriteFile



  • The 20th Anniversary Mac AFAIK was the first Apple computer to not ship in beige.


  • Garbage Person

    Naw, the Macintosh TV appears to be the earliest. Of course, its a black LC500 with the only other distinction being the TV tuner. So I guess it depends where you draw the line on model.



  • Nope. The Apple IIe+ shipped in platinum, and the //c and IIGS were white. OTOH, 8-bit, WGAF.

    Filed Under: And the Apple I had a stained wood case, but are you really going to pay $200K for a 1st gen home computer just because The Woz personally felt it up?


  • FoxDev

    @ScholRLEA said:

    but are you really going to pay $200K for a 1st gen home computer just because The Woz personally felt it up?

    Me? no, but if you know of one that's on the market in good nick i know someone who would buy it in a heartbeat.



  • @ScholRLEA said:

    First off, for a garbage collected language, you generally want to set a runtime limit at the start of the program

    The limit is whatever the OS will allow or the maximum size the heap has reached, rounded up to the next 4KiB.

    @ScholRLEA said:

    Second, you have to keep in mind that your process(es) won't be alone in memory.

    With virtual memory, that's basically what it is.

    @ScholRLEA said:

    Third, in the Linux code, you are using the C API, rather than direct system calls, correct?

    Nope, no C in my project at all. The whole runtime is written in x86 assembly.


  • Garbage Person

    Those are just shades of beige



  • @accalia said:

    @flabdablet said:
    16EiB of memory should be enough for anybody.

    that's what we said when we were still measuring in kibibytes.

    it might take us a while but we'll eventually need more than that for something

    Like mapping the neighboring galactic quadrant?


  • FoxDev

    @redwizard said:

    Like mapping the neighboring galactic quadrant?

    at a quantum scale?



  • @accalia said:

    at a quantum scale?

    You wanted high resolution, right? ;-)


Log in to reply