Skip to content

Multithreading is broken #650

Open
Open
@m-mueller678

Description

When running this program with 2 CPUs, only the main thread and one additional thread get to run. Uncommenting the yield on the main thread fixes it. I would expect that all threads get to run, since all threads but the main thread continuously yield.

fn main(){
    for i in 0..{
        std::thread::spawn(move || {
            dbg!(i);
            loop{
                std::thread::yield_now();
            }
        });
        // std::thread::yield_now();
    }
}

qemu:

qemu-system-x86_64 -cpu host -enable-kvm -display none -smp 2 -m 8G -serial stdio -kernel ~/Downloads/hermit-loader-x86_64 -initrd target/x86_64-unknown-hermit/debug/hermit-rs-template

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions