Skip to content

OpenHFT/Puzzles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Puzzles

These are some Puzzles and exercises to get you thinking about low level Java programming and using Chronicle’s OpenHFT software

While each answer is very short, and if you know it you can answer it quickly, it can take a significant amount of time to understand the code and find that answer.

This is typical of the work we do. We are not looking for large amounts of code or code changes, but thoughtful and necessary ones. Sometimes you can be the most productive changing a single line of code. Other days you might write hundreds of lines of code and documentation.

Note
These puzzles will exposure you to parts of Core Java and ways of using it that developers with 10 or 20 years experience may have never used it. In many cases, deliberately so as we are looking to put Java to its limits.

Puzzlers

These are simpler Puzzlers where you have to make a short fit to the code and answer one or more questions

Setup

You will need

  • Install an IDE such as IntelliJ Download

  • a Download ZIP of this repository, see the [Code] button in the top right and unpack it.

  • Open the project via the pom.xml in your IDE.

  • Check you can do a maven install of the root project (on the right in IntelliJ)

Stack Traces

In PrintStackTraceMain the code prints the stack trace two different ways.

  • Why does the stack trace include the createStackTrace method?

  • Why is it different the second time. Hint: stepping through the code in your debugger should help.

In AnotherStackTraceMain the code prints a stack trace from another thread.

  • What does the line at net.openhft.stackpuzzler.AnotherStackTraceMain.thinking(AnotherStackTraceMain.java:19) show?

  • There is a stack trace line net.openhft.puzzlers.stack.AnotherStackTraceMain$$Lambda$1/214126413.run what does this mean?

Ping Pong example

In PingMain.java and PongMain.java two program alternate a value via shared memory.

  • What does 10 * time / count / 10.0 do?

  • What is the difference between milli-seconds, micro-seconds, nano-seconds?

  • When you run these two programs, what are the results?

  • How do you know this is writing to memory but not to disk with each operation?

Exercises

These are exercises where you need to write some code and provide longer answers.

TBD

Releases

No releases published

Packages

No packages published

Languages