Code Monkey home page Code Monkey logo

Comments (7)

sogaiu avatar sogaiu commented on August 16, 2024 1

Another possibility is to add to the existing documentation on the event loop.

Though in that case perhaps the multithreading page could be rewritten to point at a section of the modified event loop documentation?

from janet-lang.org.

sogaiu avatar sogaiu commented on August 16, 2024 1

In the mean time, I've assembled / remixed a document regarding recent developments: Threading in Janet using ev.

from janet-lang.org.

sogaiu avatar sogaiu commented on August 16, 2024 1

Is the issue here that the current chapter on threads (multithreading) should use functions from ev?

In case it wasn't clear, the thread module was deprecated with the 1.17.0 release -- see the third item from the top of the CHANGELOG.md file.

If one wants to use thread stuff in Janet going forward, then I believe the thread support in ev is the recommended built-in path.

So it seems like the current page on multithreading continuing to exist in its current form doesn't communicate that message.

from janet-lang.org.

sogaiu avatar sogaiu commented on August 16, 2024 1

FWIW, the text I linked to is basically a rearrangement of existing material that was written by others (I think mostly bakpakin).

As I understand it "Threads in Janet" make use of (but are not the same thing as) underlying operating system thread primitives, e.g. pthreads on unixen or if on Windows whatever is used by Janet there. "Threads in Janet" are an abstraction on top of those things -- we don't get access to everything they can do (for good reasons IIUC).

from janet-lang.org.

uvtc avatar uvtc commented on August 16, 2024

Is the issue here that the current chapter on threads (multithreading) should use functions from ev?

If that's the case, another option may be to create a "concurrency and parallelism" directory that contains chapters on:

  • fibers (which has its own subdir docs)
  • event loop
  • threads

(I think I remember seeing @bakpakin write in the chat that if the function name has "thread" anywhere in it, then it's talking about actual threads (that map to native threads). Correct?)

An intro chapter in such a top-level "concurrency-and-parallelism/index.mdz" doc would be an excellent place to make some things clear from the get-go --- my understanding of these things so far is:

  • fibers: for concurrency ("time-sliced"). "Scheduling" is done cooperatively (via yield and resume).
  • threads: for parallelism (if multiple CPUs are available). Scheduling is done preemptively (by the OS). Threads in your program map directly to native (aka kernel) threads.

from janet-lang.org.

uvtc avatar uvtc commented on August 16, 2024

@sogaiu , in your Threading in Janet using ev doc, you write:

"Threads in Janet do not share a memory heap and must communicate via message passing using a thread channel."

My understanding is that all threads share the process's address space and resources... they all have access to the program's globals, correct? Maybe I'm confusing those things with the memory heap you mention in your doc?

from janet-lang.org.

 avatar commented on August 16, 2024

The section has now been rewritten and this problem has been fixed.

from janet-lang.org.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.