De-Lurk: My P2 Project Plans:


The "Grand Plan" is to build a virtual P2 server/minicomputer.


What do I mean by this?

In a headless process I can start any number of arbitrary "P2s". Interaction with them would be done via some kind of client (be it curses, SDL, GL, or even web I suppose). Code loading, simulation, debugging etc... all via those clients.

Then, after a bit I'd build the thing for real.

Here's my current tasklist:
  • Model the processor in OTP code.
  • Bytecode disassembler (Primarily to verify that my parsing of the bytecode is accurate for calling the virtual OpCode dispatch table).
  • Implement each OpCode in the VM.
  • Build some kind of UI (Some kind of variant of a PDP-11/IMSAI 8080 type console would be just the ticket). Being able to stop/start/step/change speed of your system clock is something I miss from the bit-twiddling days. As the whole thing is virtual, it should be possible to do all the introspection you could possibly need to do.
  • Build in hardware ;-)

The other advantage of using OTP to model this system is that I can generate any arbitrary number of P2s and link their pins in any way which means I can conceivably model meshes of P2s before building them.

I'm most of the way through parts 1 and 2. Part 3 scares me a little because I still don't fully understand how all the instructions work.

As we go.

Comments

  • 8 Comments sorted by Date Added Votes
  • KeithEKeithE Posts: 937
    edited October 19 Vote Up0Vote Down
    What is "OTP code"? Erlang?
  • octettaoctetta Posts: 31
    edited October 19 Vote Up0Vote Down
    KeithE wrote: »
    What is "OTP code"? Erlang?

    It’s kind of like a standard library of code and task / communication management practices.
  • __red____red__ Posts: 366
    edited October 19 Vote Up0Vote Down
    octetta wrote: »
    KeithE wrote: »
    What is "OTP code"? Erlang?

    It’s kind of like a standard library of code and task / communication management practices.

    Back in the 1980s a research group at Ericsson were tasked to design telephone switches that would not break down. They went through lots of different technologies, languages, techniques, and ended up inventing a new language (erlang) and a new way of structuring applications (OTP - Open Telecom Project).

    They achieved nine nines of availability, including zero downtime for upgrades.

    The philosophy behind OTP really is this:
    • You can't enumerate every way that your software can fail so why pretend?
    • Write software structured as many different "actors" who only communicate via messages. Plan for messages to get lost. Plan for your actors to crash. Plan for your data to get corrupted. If any of the above happen, kill all your children and try again (the language does this for you automatically).
    • Failure is considered normal. It is not unusual in any of my busy production applications for me to have hundreds of processes fail a minute yet the application continue to operate flawlessly.

    Most faults are transient - for example, pulling a file from a remote site. How many times have you seen code that says "if I fail to download this, try X times".

    In erlang you'd start it as a "Supervised Process". If the file did not come down correctly, the process would crash and the supervisor would automatically restart the whole process to try again. It would do that up to (configurable) number of times.

    If that continued to fail, that supervisor would die which would then kick off your next set of logic which captured what to do if the site was actually offline completely... and so on.

    Writing your application in "trees" is a different way of thinking, but it produces code that is ridiculously reliable and scales.

  • Getting vaguely back on track - I've started blogging about the P2 and this project. First two articles are up:

    See:
    Article #1: https://evil.red/posts/writing-a-p2-simulator-in-elixir/
    Article #2: https://evil.red/posts/writing-a-disassembler-in-elixir/

    Enjoy!
  • You are going to have fun!

    And you saw what a few of us did. Multicore mini.
    Do not taunt Happy Fun Ball! @opengeekorg ---> Be Excellent To One Another SKYPE = acuity_doug
    Parallax colors simplified: https://forums.parallax.com/discussion/123709/commented-graphics-demo-spin<br>
  • potatohead wrote: »
    And you saw what a few of us did. Multicore mini.

    I did not and searching the forums doesn't locate anything - got link?
  • __red__ wrote: »
    potatohead wrote: »
    And you saw what a few of us did. Multicore mini.

    I did not and searching the forums doesn't locate anything - got link?

    The Propeller 1 was used to emulate several 8 bit microprocessors, and IIRC some 16 bitters. Try searching the forums for "emulators".
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • __red__ wrote: »
    potatohead wrote: »
    And you saw what a few of us did. Multicore mini.

    I did not and searching the forums doesn't locate anything - got link?

    Oh, I mean as a potential project. There are no links to share. It has just been side discussion.

    Do not taunt Happy Fun Ball! @opengeekorg ---> Be Excellent To One Another SKYPE = acuity_doug
    Parallax colors simplified: https://forums.parallax.com/discussion/123709/commented-graphics-demo-spin<br>
Sign In or Register to comment.