Jump to content




How to make the Multitasking OS like OneOS?



12 replies to this topic

#1 WattDev

  • Members
  • 22 posts

Posted 16 April 2017 - 11:37 AM

Hi guys.
Today I stumbled on an amazing computercraft operating system.
It is named OneOS and it has a Multitasking system.
Can you guys please make a tutorial on how to make a Multitasking OS?

#2 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 16 April 2017 - 11:50 AM

BB's Guide to Coroutines is a good starting point for learning about coroutines, and therefore implement multi-tasking. Read through the whole thing first: don't just skip to the multi-tasking section.

I'd also recommend looking at CC's multishell implementation.

Edited by SquidDev, 16 April 2017 - 11:51 AM.


#3 WattDev

  • Members
  • 22 posts

Posted 16 April 2017 - 07:57 PM

View PostSquidDev, on 16 April 2017 - 11:50 AM, said:

BB's Guide to Coroutines is a good starting point for learning about coroutines, and therefore implement multi-tasking. Read through the whole thing first: don't just skip to the multi-tasking section.

I'd also recommend looking at CC's multishell implementation.
Sorry but I am not good at lua.
Video please?

#4 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 16 April 2017 - 08:10 PM

View PostWattanaMC, on 16 April 2017 - 07:57 PM, said:

Sorry but I am not good at lua.
Video please?

If you're not very good at Lua, I'd advise not starting with a mulit-tasking OS. I'd recommend having a read through the Programming in Lua book, try a couple of simpler tasks (turtle mining scripts, etc...) and then come back when you're more comfortable with the language. A video isn't going to make this any easier: you've just got to get more comfortable programming first, and sadly that takes time :).

Edited by SquidDev, 17 April 2017 - 11:54 AM.


#5 WattDev

  • Members
  • 22 posts

Posted 16 April 2017 - 08:27 PM

Hi guys
Today I am wondering how OneOS can execute a program in .program directory
and I want to do that in my own OS
Any answer???

#6 houseofkraft

  • Members
  • 170 posts
  • LocationUSA

Posted 16 April 2017 - 08:41 PM

I agree to what SquidDev said. You should start off making basic programs first and then move to more advanced ones.
If you still want to do it, you can use the parallel API. With the API you are able to run multiple functions at once.

Example:
local function first() -- The function containing the first action
   while true do
       local _, key = os.pullEvent("key")
       print(keys.getName(key))
       os.sleep(0)
  end
end

local function second() -- The second action to execute at the same time
   while true do
       print("Press a key :D/>")
       os.sleep(0)
   end
end

parallel.waitForAll(first, second) -- Runs both functions at the same time.


#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 April 2017 - 10:44 PM

Threads merged. Please stick to one topic for questions about the OS you're thinking about building.

#8 HaddockDev

  • Members
  • 61 posts
  • LocationSomewhere, deep down under a rainbow.

Posted 16 April 2017 - 11:53 PM

SquidDev's right. If you want to make a multitasking OS, and you aren't that good at Lua: you are going to be in for a very long time.
Things you are going to have to learn: sandboxing, courotines, the event system, filesystem, a ton of Lua syntax, and much much more.

A good idea is to browse the CC wiki if your new to Lua because it will provide you with a lot of information and tutorials and such.

TL;DR: learn lots of lua, browse the wiki, use tutorials for help, and use Ask A Pro if your really stumped.

#9 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

Posted 17 April 2017 - 12:38 AM

Since all of your questions seem to center around OneOS, I would suggest you take a look at OneOS' code to see how things were done.

#10 WattDev

  • Members
  • 22 posts

Posted 17 April 2017 - 05:35 AM

View PostDog, on 17 April 2017 - 12:38 AM, said:

Since all of your questions seem to center around OneOS, I would suggest you take a look at OneOS' code to see how things were done.
*Sorry
But there's a ton of crashing bug in OneOS and I don't know how the program are used.
How do I do?

#11 WattDev

  • Members
  • 22 posts

Posted 17 April 2017 - 05:57 AM

Hi guys. Today I wanna know that is it possible to load a program as a Background Process?

#12 Exerro

  • Members
  • 801 posts

Posted 17 April 2017 - 11:54 AM

Execute program in .program directory: type in .program/some_program.lua in the shell and it'll run some_program.lua inside the .program directory.

Seriously though, if you don't know how to run a program, you shouldn't be making an OS. At best, you'll end up making a screen with a background that does nothing useful, at worst it'll... I don't think it gets any worse actually. For some context, oeed had years of experience before making OneOS and had made a previous OS that wasn't nearly as successful. They're not simple, and getting them right is very hard.

The other thing is motivation: if you're really determined to do this, it won't be easy. You'll have to get your head around new concepts, and learn things for yourself rather than just asking people for links to videos.

Whatever happens, you'll end up experimenting with code along the way, so why not just start out with the experimentation? Try to make some cool programs, tackle some problems in the Idea Exchange, or make a firework screensaver. Don't think of them as side projects, think of them as important parts on the way to making a second OneOS.

And the best of luck! CC could do with a decent OS.

#13 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 17 April 2017 - 03:14 PM

Threads merged. Stick to one topic for your OS-related questions.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users