Click Here
home features news forums classifieds faqs links search
6071 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
19 crawler(s) on-line.
 138 guest(s) on-line.
 0 member(s) on-line.



You are an anonymous user.
Register Now!
 amigakit:  36 mins ago
 Hammer:  1 hr 26 mins ago
 Rob:  2 hrs 4 mins ago
 billt:  2 hrs 12 mins ago
 amigang:  2 hrs 23 mins ago
 OneTimer1:  2 hrs 25 mins ago
 agami:  2 hrs 49 mins ago
 matthey:  2 hrs 55 mins ago
 kolla:  3 hrs 3 mins ago
 Tuxedo:  4 hrs 11 mins ago

/  Forum Index
   /  Amiga OS4.x \ Workbench 4.x
      /  "Multithreading" in OS 4.0? Whats that?
Register To Post

PosterThread
jahc 
"Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 2:31:47
#1 ]
Elite Member
Joined: 30-May-2003
Posts: 2959
From: Auckland, New Zealand

I thought because AmigaOS can create multiple tasks, and have them running in parallel, that that was multithreading.. Can someone explain what the multithreading ability thats going to be in later versions of AmigaOS actually is?

 Status: Offline
Profile     Report this post  
ssolie 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 2:46:13
#2 ]
Elite Member
Joined: 10-Mar-2003
Posts: 2755
From: Alberta, Canada

I don't know what they specifically have in mind but I sure hope they will include some common threading API wrappers along with whatever they dream up. For example, pthreads immediately comes to mind for easing UN*X ports. Another nice to have would be the Boost Thread library because it seems very clean and it is a serious contender for the next C++ standard. Those that like to play down low can use the native ExecSG thread API but I know I would like to stick to something a bit higher up to keep the code more "thread neutral" if there is such a thing.

_________________
ExecSG Team Lead

 Status: Offline
Profile     Report this post  
Samurai_Crow 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 3:35:15
#3 ]
Elite Member
Joined: 18-Jan-2003
Posts: 2320
From: Minnesota, USA

AFAIK The difference between a process and a thread is that threads have resources from the parent process that are shared between the threads.

 Status: Offline
Profile     Report this post  
ssolie 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 17:24:30
#4 ]
Elite Member
Joined: 10-Mar-2003
Posts: 2755
From: Alberta, Canada

The most important difference between a thread and a process is the cost. On the AmigaOS, the cost of context switching is already extremely low and the lack of memory protection enables you to share almost all the resources between them. Therefore, AmigaOS doesn't really need threads in its current incarnation. When the cost of process context switching rises and process resources cannot be easily shared without further costs, the need for threads rises. Threads are always lower cost and hopefully a bit easier to use when compared to processes.

There have been many attempts at creating thread libraries based on AmigaOS processes in the past to ease porting efforts, etc.

I even created a thread library myself in the past but got stuck when I found out C++ exceptions could not jump thread boundaries and required compiler modifications to do so.

_________________
ExecSG Team Lead

 Status: Offline
Profile     Report this post  
Hyperionmp 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 17:48:07
#5 ]
Hyperion
Joined: 8-Mar-2003
Posts: 502
From: Unknown

I'm by no means an expert but a thread would be a subdivision of a task and would get a fraction of the allocated time quantum of the parent task.

AmigaOS doesn't have threads, just tasks and processes (which are tasks initiated via DOS I believe).

Multithreading will be introduced in 4.1, we already have a design document for it by Hans-Joerg Frieden.

We need it for efficient SMP and other reasons.

_________________

 Status: Offline
Profile     Report this post  
Hyperionmp 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 17:48:44
#6 ]
Hyperion
Joined: 8-Mar-2003
Posts: 502
From: Unknown

I'm by no means an expert but a thread would be a subdivision of a task and would get a fraction of the allocated time quantum of the parent task.

AmigaOS doesn't have threads, just tasks and processes (which are tasks initiated via DOS I believe).

Multithreading will be introduced in 4.1, we already have a design document for it by Hans-Joerg Frieden.

We need it for efficient SMP and other reasons.

_________________

 Status: Offline
Profile     Report this post  
Rogue 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 18:06:45
#7 ]
OS4 Core Developer
Joined: 14-Jul-2003
Posts: 3999
From: Unknown

Quote:
I'm by no means an expert but a thread would be a subdivision of a task and would get a fraction of the allocated time quantum of the parent task.


Very much so. A thread is usually a separate execution unit within a task or process, running in the same address space. This is currently still a bit theoretical, since everything runs in the same address space anyway, but this difference will become more important later.

A very important point, however, is the time allocated to threads vs. tasks - all threads of a single task will run in that task's time quantum. Otherwise a multi-threaded application would get considerably more time than a single-threaded application.

_________________
Seriously, if you want to contact me do not bother sending me a PM here. Write me a mail

 Status: Offline
Profile     Report this post  
BrianHoskins 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 20:27:03
#8 ]
Cult Member
Joined: 4-Jan-2003
Posts: 726
From: South Wales, UK

AmigaOS is multitasking, which means that it can switch between tasks and execute code for them in allocated time slots at a sufficient speed such that to the user it appears that all programs are running at the same time. That's not to be confused with multi-threading though, which is a completely different thing.

As I understand it multi-threading only has a use when applied to a computer which has more than one processor. With most multi-processor machines where the OS only uses single threading you don't get a TRUE "multi-processing effect" because you can still only really do one job at a time - that's why you don't get double the speed from the machine when you add a second processor to it. Instead you only get a relatively small gain from the addition of a second processor with a single threaded OS.
With multi-threading the program execution is done in a different way and allows multiple processors to actually do different jobs so that they are ALMOST "multi-processing". As I understand it you never get pure multi-processing with a computer in the same way that you never get pure multi-tasking, but an OS that uses multi-threads is able to multi-process much much more efficiently than a single threaded OS due to the way the operating system handles the code.

This is my understanding of the subject based on what I have read up on myself a while ago, back when AmigaOS was reported to be taking the form of BeOS for future development. (BeOS was of course a multi-threaded OS) I'm not an expert and if I'm wrong with anything I'm happy to be corrected - but I hope that helps :)

 Status: Offline
Profile     Report this post  
Rogue 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 20:36:17
#9 ]
OS4 Core Developer
Joined: 14-Jul-2003
Posts: 3999
From: Unknown

Quote:
As I understand it multi-threading only has a use when applied to a computer which has more than one processor.


No, not at all. There are two major implications, process time and access rights.

Process time is assigned to tasks. If an application spawns subtasks to do its work, then it essentially is multiple programs. If you have a program that spawns ten sub-tasks vs. one that does all its processing in a single task, then the sub-task program will get time times the computing time. If the sub-tasked program is a compiler and the single-tasked program is a web browser, you will not like the result.

OTOH, if the compiler only used threads, the time would be evenly split among the compiler and the browser.

Secondly, ownership. When a process on the Amiga opens a socket or a message port, it will allocate a signal for this. A signal is task-local, meaning that if this program spawns sub-tasks, they cannot use this message port or socket because the a message arriving at the message port would signal the first task, not the sub task. Thread OTOH *can* use the tasks resources. With isolated address spaces things become even more obvious.

Finally, if we are to go multi-CPU at one point (and we *will* go multi-CPU), then we need the programs to take advantage of this

_________________
Seriously, if you want to contact me do not bother sending me a PM here. Write me a mail

 Status: Offline
Profile     Report this post  
ssolie 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 20:47:10
#10 ]
Elite Member
Joined: 10-Mar-2003
Posts: 2755
From: Alberta, Canada

@Rogue

Any hints at possible threading APIs? As I kind of hinted at above, I'm looking forward to porting Boost.Threads over to AmigaOS 4.x when the time comes.

_________________
ExecSG Team Lead

 Status: Offline
Profile     Report this post  
GadgetMaster 
Re: "Multithreading" in OS 4.0? Whats that?
Posted on 17-Aug-2003 20:53:55
#11 ]
Cult Member
Joined: 26-Dec-2002
Posts: 603
From: TrustVille

Hi Rogue

I think you will save a lot of time writing the documentation for OS4 just by collecting all your answers to technical questions asked in forums.

Keep up the good work.

BTW, Can I be a betatester?? ... pretty please.

_________________
Trust me. I'm a doctor.

 Status: Offline
Profile     Report this post  

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle