3 comments

  • vintagedave1 hour ago
    So this seems to be a mystery binary someone found on a company DVD, that runs DOS on one core and runs another core with code but no interrupts etc. Fascinating.<p>The thread later mentions a second way to do it.<p>In this setup, how would cross-core communication work, including cross-thread? On DOS is there even the concept of threads, or would an app using this have to invent user-mode thread objects and scheduling?
    • toast035 minutes ago
      &gt; In this setup, how would cross-core communication work, including cross-thread?<p>Communication via shared memory. DOS and friends run on core 0 more or less normally; core 1 runs your alternate programming. Allocate a shared ring buffer for messages in each direction, core 0 writes messages and updates the written index on one, reads messages and updates the read index on the other; vice version for core 1. Core 1 probably spins on checking the indexes if it doesn&#x27;t have anything else to do.<p>Either allocate a big chunk of memory for core 1 work at startup, or let it message core 0 to allocate. Don&#x27;t let core 1 call into DOS&#x2F;BIOS syscalls directly or you&#x27;ll have a big mess.<p>Next step in efficiency would be letting core 1 sleep when it&#x27;s bored and use an inter-processor interrupt (IPI) to wake it up as needed.
    • fredoralive1 hour ago
      DOS barely has any concept of processes, let alone threads.<p>So it’ll all be very do it yourself. Of course with everything running in ring 0, there’s not much that’s going to get in the way of you.
      • haileys35 minutes ago
        &gt; DOS barely has any concept of processes<p>That&#x27;s not true - DOS lacks multitasking but it absolutely has a concept of processes. They&#x27;re called PSPs (program segment prefixes, a struct containing data about that process) and the OS has a range of syscalls to manage them. Any program can spawn a child program and wait for its completion.<p>The memory allocation syscalls track which program owns each dynamically allocated block of memory (the block has a header which points to the PSP), and frees the blocks allocated by a program when it exits. The filesystem syscalls deal with file handles opened by processes in just the same way.<p>The famous &quot;terminate and stay resident&quot; syscall causes a program to exit and return to its parent process while keeping its PSP and dynamically allocated memory blocks intact.<p>16 bit Windows introduced multitasking but reused DOS&#x27;s PSP based process model and would allocate a PSP for each Windows task, switching the current DOS PSP when switching between Windows tasks.
    • kmeisthax47 minutes ago
      DOS has no concept of multiple cores, much less threads. Multiprocessing in such an environment &quot;works&quot; mainly for the same reason why pthreads and friends &quot;worked&quot; in the decades before C++11 standardized a memory model for native code. The hardware and your code must conspire to work around the part that isn&#x27;t thread-aware.<p>Nothing is really stopping you from using the underlying hardware for concurrent execution, but at the same time DOS (and possibly BIOS&#x2F;UEFI???) will blow chunks if you don&#x27;t carefully synchronize access to it. Cross-core communication works exactly the same as it does in kernel-mode systems programming; and you need to bring your own synchronization primitives on top of the ones x86 processors ship with. You&#x27;re basically writing an OS kernel at that point; one that just so happens to support kexec-ing back into COMMAND.COM and using bits of it as a filesystem driver.
  • ronsor1 hour ago
    &gt; ERR_HTTP2_PROTOCOL_ERROR<p>Hm?