• Post Reply Bookmark Topic Watch Topic
  • New Topic

Are OCJP threading questions affected by OS/processor details

 
Amit Ramesh
Greenhorn
Posts: 9
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry,

Regarding the idea of how many theads can be runnable at one given time, this was the passage from Sierra Bates SCJP 6 study guide I was referencing:


The Thread Scheduler
The thread scheduler is the part of the JVM (although most JVMs map Java threads
directly to native threads on the underlying OS) that decides which thread should
run at any given moment, and also takes threads out of the run state. Assuming a
single processor machine, only one thread can actually run at a time. Only one stack
can ever be executing at one time. And it's the thread scheduler that decides which
thread—of all that are eligible—will actually run. When we say eligible, we really
mean in the runnable state.
Any thread in the runnable state can be chosen by the scheduler to be the one and
only running thread. If a thread is not in a runnable state, then it cannot be chosen to be
the currently running thread. And just so we're clear about how little is guaranteed here:
The order in which runnable threads are chosen to run is not guaranteed.
Although queue behavior is typical, it isn't guaranteed. Queue behavior means
that when a thread has finished with its "turn," it moves to the end of the line of the
runnable pool and waits until it eventually gets to the front of the line, where it can
be chosen again. In fact, we call it a runnable pool, rather than a runnable queue, to
help reinforce the fact that threads aren't all lined up in some guaranteed order.
Although we don't control the thread scheduler (we can't, for example, tell a
specific thread to run), we can sometimes influence it. The following methods give us
some tools for influencing the scheduler. Just don't ever mistake influence for control.



I know that this text is almost 10 years old, and most machines are multi core now - so they allow more than 1 thread to be runnable simultaneously.
When I take the OCJP 6 exam, can a threading problem's answer change based on if I were envisioning the question on a single core or multi core processor?
Or for all threading questions on the exam, should the answer always be the same regardless of whether the code is run on a single core or multi core processor?
 
L Foster
Ranch Hand
Posts: 205
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Amit, why bother with the Java6 certification? According to this link below, you can already do Java8

https://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=653&get_params=p_id:357#tabs-2-2

I'm surprised they still offer Java6. I have that myself, and that was 2009.

That said, there should not be anything platform-specific in the test. The tests are meant to be about Java, with its platform-neutral concepts. Also, they do use the word "assuming". It is not impossible to find a single-processor machine (OK, maybe you'll have to borrow an old one from a friend) even now. Heck, with virtualization, you could even make a single-processor virtual machine.

Good luck on your exam.
 
Amit Ramesh
Greenhorn
Posts: 9
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi L,

The reason I was taking the OCJP 6 exam was financial.
In order to reach professional level certification with Java 8, I would have to take the OCJA and the OCJP. - $245 + $245
With the Java 6 exam, I could reach professional level by taking the OCJP only. $245 only.
Due to limited funds, I was trying to reach the professional level as inexpensively as possible.


BTW I took my OCJP exam yesterday and passed with 78%.
Once I save up some more money, I plan to take the upgrade exam in the future, but at least for now, I am professionally certified.
 
L Foster
Ranch Hand
Posts: 205
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations! That's true: not a bad strategy. Oracle is trying to make more $$ on this than Sun did. Unfortunately, they may be excluding a broader audience--people, for instance, whose organizations have not bought into the Java bandwagon. If you have to fund these things yourself, you care how much it costs. And sadly, there are organizations out there who are actually distrustful of Java, simply because it has broad adoption.

Here's to your success!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!