LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2014, 05:41 PM   #1
RozenKristal
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
Operating System thread switching and saving


I am not sure if this is the best sub for my question... I hope though that the mods can help me move the thread to appropriate place if I misplace it.
I am currently in a operating system class, and I have a question related to thread switching and save the previous thread when switch. So the question is like this:
Code:
The use of Hardware Threads or Hyper-threading is becoming commonplace in the design of 
new processors. For example, the Core i3 and i5 lines include hardware provisions to handle two 
hardware threads per processor (core). This is done by duplicating those parts of the processor 
that store the architectural state, namely, the control and general purpose registers, but not 
duplicating the main execution resources (e.g., pipelining). In short, only one of the hardware 
threads can be executing, but each one of the two hardware threads has its own set of registers.
Assume that your architecture has two cores (processors), each equipped with two hardware 
threads. Assume you are running a process composed by 8 threads, each connecting to a 
lightweight process (thus, visible to the kernel as kernel threads). Each of the threads repeats the 
following cycle a large number of times:
CPU usage 10ms, I/O 10ms
Assume that the scheduler switches threads every 5 ms. Fill out a table like the following, indicating the 
state of each of the threads at every interval. Also, indicate, by the symbols S, and NS whether the 
switch caused the saving (or not) of the architectural state of the preempted thread. Assume that no 
other process or thread is present in the system.
5ms 10ms 15ms 20ms 25ms 30ms 35ms 40ms 45ms 50ms 55ms 60ms
T1
T2
T3
T4
T5
T6
T7
T8
I know that because there is 2 Hardware threading in 1 processor, so the process could have 2 thread run concurrently... and when it switch from T1 and T2 to T3 and T4, T1 and T2 go to ready state. How do the saving of the thread happen? According to the solution my professor give, the saving of T1 and T2 only occur when T5 and T6 go to the running state, but not when T3 and T4 at the running state. My question is why it doenst save immediately when it switch to T3 and T4 threads?
 
Old 10-06-2014, 06:38 AM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Why not ask him/her?
 
Old 10-06-2014, 08:10 AM   #3
RozenKristal
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JeremyBoden View Post
Why not ask him/her?
Because it was weekend. It would be great if I get some answer from here though. Isnt this forum LinuxQuestions??? ._.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Operating System thread level monitoring & memory, CPU usage on service with OpenNMS jitenderana Linux - Newbie 7 11-06-2012 09:07 AM
saving current setup when switching user on centos always87 Linux - Newbie 5 07-18-2010 08:32 PM
'Operating system not found' Any operating system installed wont work. TechniSlave Linux - Newbie 55 02-09-2009 11:02 AM
saving operating system stormbay Linux - Desktop 2 12-17-2008 03:42 AM
help a newbie switching operating systems kinghimself Linux - Newbie 6 11-09-2003 08:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration