Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Confusion over Multi Threading Post 302930767 by jimthompson on Wednesday 7th of January 2015 06:17:25 AM
Old 01-07-2015
Confusion over Multi Threading

Hi, I am trying to get my head round Multi Threading and I have a few queries to try and clear up my confusion

Q1. Is multi threading a hardware / chip level concept, an OS level or an application level concept ? I am trying to work out where SMT architecture fits in.

Q2. What's the multi threading position in relation to Unix, Linux and Windows ?

Q3. Is multi threading only in relation to application processes or is it for OS processes as well ? I am trying to differentiate multi threading from the older CPU concepts of timeslicing, round robin etc

My understanding is that you can have multi processing systems which switch between or execute processes in parallel. However multi threading takes this a step further in that a process can be broken down into threads and the processor execute the individual threads ( again via switching or parallel depending on the number of processors / cores you have )

Q4. Are processors therefore specifically designed either to execute full processes, threads or both ? Can a single processor execute a mix of full processes and threads ? i.e. does a processor operate only at either a process level or a thread level ?

Q5. What's the difference between a single processor with multi cores and a multi processor with single core processors ?

Q6. Are most modern processors today, multi thread capable processors ( or is it the OS which determines this ). Does the processor have to be specifically set to multi threading ?

any help greatly appreciated
Jim
 

10 More Discussions You Might Find Interesting

1. Programming

Multi threading using posix thread library

hi all, can anyone tell me some good site for the mutithreading tutorials, its application, and some code examples. -sushil (2 Replies)
Discussion started by: shushilmore
2 Replies

2. Programming

Multi-threading questions

I've been doing some reading lately about threading (Posix threads) and I'm really curious about a couple things that I've read. I'm not sure if many people here have threading experience, but I thought it would be nice to be able to discuss some questions about it. (For the record, I did... (1 Reply)
Discussion started by: DreamWarrior
1 Replies

3. Programming

Multi threading using fork

Hi, I have written a code which will run a set of process using fork. I want to know from You how can i start another job when one of my job in my loop is completed My code is #include<stdio.h> #include<ctype.h> main() { int pid,cid; ChildProcess(); ... (1 Reply)
Discussion started by: sureshraju_ma
1 Replies

4. Programming

Regarding Multi-Threading

Hi All, Here's my question I have a 385 MB file containing 5,000,000 records. I need to read from the file and load into a table. Initially i thought of doing it in a single thread (execution of a single program) but when calculated accounted 16 hours of time on a standard benchmark. Hence... (5 Replies)
Discussion started by: matrixmadhan
5 Replies

5. Programming

Multi threading?

I am not sure if multi threading is the correct term, but here is what I am trying to do. I have a while loop that displays the number 1, pauses, displays the number 2, pauses , displays the number 3 ad infinitum. It just keeps counting. While the screen displays the sequence of numbers counting... (4 Replies)
Discussion started by: enuenu
4 Replies

6. Programming

Multi-threading-- calling same function through different threads

Sir, Can I call same function in the start routines of different Threads. I have created two different threads....and wanna call same function from both threads....is it possible??? Also can I fork inside a thread??? (1 Reply)
Discussion started by: arunchaudhary19
1 Replies

7. Programming

Multi-threading

Hi, If we create 10 threads to invoke runQuery method at same time, Will queryProcessor will be overriden sometime or 10 different copies will be created? We are not using any sunchronzation mechnism in runQuery(). so there is not gurantee on QueryProcessor class variables right OR each 10... (1 Reply)
Discussion started by: jramesh1
1 Replies

8. Programming

Multi-threading

In this piece i implemented the gossip method. The first thread is invoked from inside the (msg is first sent from node -1 to 0 from main()) and the other threads are invoked from inside of the thread function itself. I used two mutexes and a condition variable to control the synchronization. ... (4 Replies)
Discussion started by: saman_glorious
4 Replies

9. UNIX for Beginners Questions & Answers

Does UNIX support multi-Threading ?

Not just background process running ... but im looking if unix has any multi-threading concept like in Java, C# ... if not present, can you pls share the nearest feature in unix that is close to multi-threaded concept (3 Replies)
Discussion started by: i4ismail
3 Replies

10. UNIX for Beginners Questions & Answers

Multi threading in UNIX

Hi, Can we apply multi threading in Unix. I am using bash shell. We have a generic script to load the data to table based on file input. For each file there is an individual table to load. For each file found in directory I want to load the data in parallel to target table using ... (3 Replies)
Discussion started by: vedanta
3 Replies
mpsched(1)						      General Commands Manual							mpsched(1)

NAME
mpsched - control the processor or locality domain on which a specific process/lightweight process (LWP) executes SYNOPSIS
cpu command policy] policy] locality-domain-id] spu] command policy] locality-domain-id] spu] pid}... locality-domain-id] spu] lwpid}... DESCRIPTION
controls the processor (spu), or locality domain (locality-domain-id) on which a process/LWP executes. It can do this by binding a process/LWP to a particular processor or locality domain (ldom), or by setting the launch policy for the process. The command can be invoked in the following manners. o With it prints a help message. o With it returns the hardware configuration of the system. This includes information about the number of locality domains and pro- cessors active in the system. o With it returns the system topology at the locality domain, proximity set, socket and core level. This includes information about the number of locality domains and processors active in the system. Processors on the same front side bus (FSB) form a proximity set. o With it returns the system topology at the socket level. o With it returns the system topology at the proximity set level. o With it returns the processors in the same locality domain as the processors specified in the arguments. o With it returns the processors in the same proximity set as the processors specified in the arguments. o With it returns the processors in the same socket as the processors specified in the arguments. o With it returns the processors in the same core as the processors specified in the arguments. o With it enables gang scheduling for a command and its arguments. See gang_sched(7). o With or plus a command and its arguments, it applies the binding or launch policy to the command. o With it applies the binding or launch policy to the specified pid. o With it applies the binding to the specified lwpid. Options The command-line options are: Bind the specified processes/LWPs to the spu listed. This will ensure that the processes/LWPs always run on the specified processor. In the Processor Set (pset) con- figured system, binding will be successful, if spu belongs to same pset where process/LWP is bound. This option can be used with the and options. Allows processes/LWPs to bind to spu or ldom, when PRM is installed in the system. Enable gang scheduling on the process. No other options should be used with Print a help message. Bind the specified processes/LWPs to the locality-domain listed. This will ensure that the processes/LWPs always run on a processor within the specified locality domain. In the Processor Set (pset) configured system, binding will be successful, if ldom to the process/LWP is in same pset where process/LWP was bound. This option can be used with the and options. Specify process ID, pid. To use the option, the caller must be a member of a group having access, be superuser, or have the same effective user ID as the pid. Specifying a command instead of the option does not require special privileges. Multiple options can be specified per command line, although each option can take only a single process ID. Specify lightweight process ID, lwpid. To use the option, the caller must be a member of a group having access, be superuser, or have the same effective user ID as the lwpid. Multiple options can be specified per command line, although each option can take only a single lightweight process ID. The target LWP (lwpid) can be in any process. Query the system regarding process/LWP bindings. This will return information about whether processes/LWP are bound to a processor or locality domain. It will also report on the thread and process launch policies for the processes. If this option is used in conjunction with then only those processes/LWPs specified are queried respectively. If this option is specified alone, then the status of all processes on the system that differ from the default settings are displayed. Print the system hardware configuration. No other options should be specified. Print the system topology at the locality domain, proximity set, socket and core level. No other options should be specified. Print the system topology at the socket level. No other options should be specified. Print the system topology at the proximity set level. No other options should be specified. Print the processors in the same locality domain as the processors specified in the arguments. This option can be used with the -b, -r and -k options. Print the processors in the same proximity set as the processors specified in the arguments. This option can be used with the -d, -r and -k options. Print the processors in the same socket as the processors specified in the arguments. This option can be used with the -d, -b and -r options. Print the processors in the same core as the processors specified in the arguments. This option can be used with the -d, -b and -k options. Unbind the specified processes/LWPs from any processor or locality domain bindings that can be present. This option can be used only with or and no other options can be specified. Apply the specified policy to the processes. Launch policies affect the locality domain on which a process is spawned. Refer to mpctl(2) manpage for details on launch policies. This option can be used with the and options. policy is one of the following values: Round robin launch policy. Under this policy, successive direct child processes of the specified command or process are launched in a round robin fashion across the other locality domains in the system relative to creating process. Tree based round robin launch policy. Under this policy, successive child processes and their descendents are launched in a round robin fashion across the other locality domains in the system relative to creating process. Least loaded launch policy. Under this policy, child processes are launched on the least loaded locality domain in the system at the time of creation. Fill first launch policy. Under this policy, successive direct child processes of the specified command or process are launched on the same locality domain as their parent until one has been launched on each processor in the locality domain. At that point, new processes are created on the next locality domain. Tree based Fill first launch policy. Under this policy, successive child processes and their descendents are launched on the same locality domain as their parent until one has been launched on each processor in the locality domain. At that point, new processes are created on the next locality domain. Packed launch. Under this policy, successive processes are launched on the same locality domain as their parent. A different domain is never selected. No special policy. The default HP-UX launch policy is used. Apply the specified policy to the threads of the process. The scheduling policies are the same as for the option except that they apply to newly created threads instead of processes. Also, thread policies can only be specified on commands launched from the command line of The option can be used with the and options. Operands The command-line operands are: command A command including its arguments. RETURN VALUE
returns exit status 0 if command is successfully scheduled or -1 if it fails. EXAMPLES
Execute the file on processor 2: Set the process launch policy for the existing process with pid 24217 to round robin: Bind the processes with pids 1247 and 1842 to processor 4: Bind the Lightweight Processes with lwpids 12345 and 12346 to locality domain 2: Print the processors in the same proximity set as processors 0 and 4: Print the system topology at the locality domain, proximity set, socket, core and processor level: AUTHOR
was developed by HP. SEE ALSO
getprivgrp(1), setprivgrp(1M), fork(2), getprivgrp(2), mpctl(2), pstat_getlwp(2), privgrp(4), gang_sched(7). mpsched(1)
All times are GMT -4. The time now is 06:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy