-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
concurrent tasks should be executed by different OS threads #1
Comments
The main concern is establishing what can and can't be done in a parallel section, such as in one of the counted loops. Can malloc/free be called, can setjjmp/longjmp be called, can _Thread_local variables be consulted, can tss_t variables be used without races. There is clearly compiler/runtime magic going on to make things compute in parallel, but some of that magic bleeds through. The goal seems to be that C11 standard threads will be used, by magic, to do computation concurrently, and that anything legal in a non-parallel context is legal in the parallel section. If so, then the correlation between "OS Thread" and that which thrd_create returns has to be made. Another way to ask the question is whether thrd_current() is well-defined in a parallel section, i.e. can be used to distinguish concurrent executions of the parallel section. Given that 7.26.5.1 simply says "thrd_create function creates a new thread..." I think the simplest proposed resolution to this is to The definition of concurrent and parallel programs is somewhat bogus since, well, it is C11 and atomics does apply, and so just because the synchronization among worker threads and calling thread is hidden doesn't mean it doesn't exist. Simply saying that the counted loop compound statements (blocks) are executed on compiler/runtime worker threads is the truth - that they, internally become units-of-work in some fashion and may be called "tasks" for that runtime doesn't mean its worthy enough to merit its own definition. There are no operations on "tasks", so its unnecessary conceptual overhead. |
As a potential user, I would like it if we could leverage C11 threads here, because that would make it possible to reason about the behavior of I do not think we should refer to OS threads at all, since C11 should be sufficient and there's no need to refer to operating system features in a programming language specification. If C11 threads are inadequate to specify the implementation details, then there's something wrong with how C11 threads are specified that should be fixed. Building CPLEX features on C11 threads would have the added benefit of compelling implementers to support C11 threads at some point in the future. I am unaware of a single production implementation of C11 threads... |
I am willing to take on the non-trivial task of updating the definitions and usage of "thread" and "task" in the WP. Tasks that run concurrently within a program should be assumed to run on separate C threads, and the C thrd facilities should be available for accessing _Thread_local storage, thread ID, etc. The term, "task" is a term of art in the parallelism world and must stay, but is not adequately defined in the current WP. A task is not a thread, but a thread can run a task. Blaine points out that the current definition of a task could apply to completely independent threads. That is not necessarily a bad thing, but I think we do need to make it clear that a task might or might not run independently on other tasks, depending on how the task is created in the program. This will take a little work, but I think it is doable in time for the WG14 meeting. |
Proposed resolution is attached: CPLEX-Issue-1.pdf |
That's the intention, but we probably don't say it adequately.
The text was updated successfully, but these errors were encountered: