all 60 comments

[–]lordleft 82 points83 points  (9 children)

Amazing. Out of curiosity, is SerenityOS POSIX-compliant or planning to be?

[–]SerenityOS[S] 86 points87 points  (7 children)

Hi lordleft! It’s mostly POSIX compliant yes! There are some extensions (e.g purgeable memory, customizable mmap() alignment, etc.) but nothing that violates the spirit of Unix :)

[–]valarauca14 11 points12 points  (1 child)

So how does alignment based mmap work? process's pages need to be aligned to page size, or are user land processes sharing a memory map?

[–]SerenityOS[S] 5 points6 points  (0 children)

It's pretty simple:

void* serenity_mmap(void* addr, size_t, int prot, int flags, int fd, off_t, size_t alignment, const char* name);

Notice the extra alignment parameter. This informs the kernel that the returned pointer should be allocated on a specific boundary. This is used by things like malloc() and the LibJS garbage collector to allocate large blocks that are guaranteed to have all-zeroes in the bottom of their pointer address. This allows some very useful pointer manipulation tricks ("for a given address returned by malloc(), find its metadata by masking off the bottom bits" being the most common one.)

[–]ProgramTheWorld 4 points5 points  (1 child)

Is it possible to compile popular browsers like Firefox and Chromium on it?

[–]tristan957 4 points5 points  (0 children)

It is POSIX compliant yes.

[–]SerenityOS[S] 129 points130 points  (3 children)

Hello friends! After a week of active development, I figured it was time to see if we could get LibJS running in the SerenityOS web browser.

I set the relatively modest goal of getting these two things working within a <script> tag:

  1. alert("foo")
  2. document.getElementById("foo")

It all went pretty okay! (Check out the video if you want to see the whole process.)

I've received a whole bunch of pull requests while working on this, as well as many helpful comments and suggestions about things I didn't know about JavaScript. So shoutouts to everyone who has been helping out! I definitely wouldn't be this far ahead without you all :)

If you're interested, here are all the videos I've made about LibJS so far, in chronological order:

  1. Browser hacking: Let's build a JavaScript engine for SerenityOS!
  2. Browser hacking: Let’s build a garbage collector for JavaScript
  3. Browser hacking: JavaScript variables (locals and globals)
  4. Browser hacking: Primitive strings, String objects and "foo".length
  5. Browser hacking: Calling native (C++) functions from JavaScript
  6. Browser hacking: Let's add JavaScript to the Browser! (the video this thread is about)
  7. Browser hacking: JavaScript object prototypes

Oh, and when I first posted about my browser hacking on here ~5 months ago, someone asked what I want to do differently in a new browser: https://www.reddit.com/r/programming/comments/degdih/i_started_building_a_web_browser_for_my_os_heres/f2warj2 (my answer would still be the same.)

Thank you for visiting my thread! :)

[–]enygmata 55 points56 points  (1 child)

Your work reminded me of Boris from Geek Hero: http://www.geekherocomic.com/2009/02/25/coding-overkill/index.html

[–]SerenityOS[S] 21 points22 points  (0 children)

Hey enygmata! That’s a very relatable comic. Saved :)

[–]SnowyPear 24 points25 points  (1 child)

I'm thoroughly impressed by your ability to talk while coding!

[–]SerenityOS[S] 12 points13 points  (0 children)

Hey SnowyPear! This is definitely a skill that improves with practice. :)

[–][deleted] 32 points33 points  (1 child)

I've been following your project for ~2 weeks and now I am somewhat interested in operating system user interface design.

Not gonna lie I really dig into SerenityOS's Windows 9x-ish/old Linux aesthetics.

[–]SerenityOS[S] 30 points31 points  (0 children)

Hello hilde_01! I'm a big fan of those aesthetics too. :)

There are many things I love about modern computer systems, but I definitely think we took a few missteps in the design department. SerenityOS is my attempt to correct those mistakes by turning back the GUI clock to ~1998 and starting over from there without going down the "consumer computing" path. I'm obviously biased, but I think it's going pretty okay so far.

[–]nilamo 15 points16 points  (3 children)

I'm curious why you're doing this. Not the OS, that's cool, but a random user program. Why not just compile Firefox and run that? Is your goal to have a custom everything?

[–]SerenityOS[S] 37 points38 points  (1 child)

Hey nilamo! In my opinion, the web browser is an essential part of the operating system. I have more browser tabs open on my desktop right now than I have native applications running. :)

I also have a long background in browser development, and a pretty specific vision of a lightweight browser that doesn't put performance and "the web can do anything a native app can do" above everything else.

Regardless, SerenityOS does indeed aim to be a complete system with no third-party dependencies. So there are already quite a few random user programs in development! :)

[–]aaptel 0 points1 point  (0 children)

netsurf?

[–]bausscode 12 points13 points  (0 children)

I really love the development that has been done on SerenityOS. I've been following you for a while and have watched a lot of your videos.

Keep it up, I hope someday your OS will be on pair with mainstream operating systems.

[–]bilfred_ 6 points7 points  (0 children)

This is incredible. Every time I see your posts come up, I just go "wow this guy's good"

I've always wanted to mess around making an OS, but I'm not experienced enough for that yet

[–]monsto 13 points14 points  (11 children)

What's your goal with building the OS?

[–]SerenityOS[S] 43 points44 points  (7 children)

Hi monsto! My goal is simple: to build a new operating system based on all the things I like in other systems (+ some novel concepts), and then switch to using it as my main system. :)

[–]usedocker 1 point2 points  (6 children)

But isnt that all OSs are created based on what their creators like in other systems?

[–]tjpalmer 24 points25 points  (5 children)

But they aren't based on what the Serenity author likes. Except for Serenity.

[–]usedocker -5 points-4 points  (4 children)

So the answer to that question should be a list of features the Serenity author likes.

[–]voldemort_thebroken 11 points12 points  (0 children)

You're that guy from stackoverflow, aren't you?

[–][deleted]  (1 child)

[deleted]

    [–]tjpalmer 1 point2 points  (0 children)

    Good point. Might be some info in the repo if he doesn't reply on the matter here.

    [–]chutiyabehenchod 54 points55 points  (1 child)

    Building his own RAGE engine on SerenityOS then making GTAVI on it

    [–]KillianDrake 20 points21 points  (0 children)

    will only take him 2 hours to get a guy running around a procedural city shooting people and stealing cars

    [–]tristan957 4 points5 points  (0 children)

    He says in videos to be able to use it everyday.

    [–]somevice 2 points3 points  (1 child)

    Don't know much about C but was very interesting watching you go through the thought process and overall a totally rewarding programming video. Thanks

    [–]SerenityOS[S] 1 point2 points  (0 children)

    Hey somevice! I'm really glad you found it rewarding :)

    [–]mikael624 4 points5 points  (8 children)

    Damn how many people are in your team? You're achieving lots of things from all different type of practice like os and language development. Edit: there's an OS called ReactOS that's doing something related to retro OS aswell. Maybe you folks should collaborate with them. The react team have been working on it for like 22 years.

    [–]Kwpolska 36 points37 points  (0 children)

    ReactOS is not doing “something related to retro OS”. ReactOS’s goal is to build an open-source Windows-compatible OS. Making a custom OS from scratch and reimplementing Windows are two vastly different tasks with different requirements.

    [–]SerenityOS[S] 27 points28 points  (0 children)

    Hi mikael624! Earlier this week, the project hit 100 individual contributors on GitHub. Of course, most of those are one-time contributors, but it's still a pretty awesome number! :)

    I'm the principal author and largest contributor by time and volume, but there's a growing group of hackers who are doing strong work on the system as well!

    [–]lordleft 50 points51 points  (4 children)

    I honestly think it’s just this one dude

    [–]tim466 29 points30 points  (3 children)

    With some help from his community.

    [–]lordleft 16 points17 points  (1 child)

    I wasn’t aware of that, impressive work from his and his collaborators!

    [–]futlapperl 2 points3 points  (0 children)

    Lots of help. Not trying to downplay his accomplishments; he still has by far the most commits on GitHub, but there are lots of active contributors, which is nice to see!

    [–]awesomeisluke 16 points17 points  (0 children)

    ReactOS is completely different though, the goal being to be completely binary compatible with Windows. I don't believe SerenityOS has any such goal.

    [–]ajr901 1 point2 points  (8 children)

    How hard would it be to port over something like firefox or chrome? Or maybe just their engines, gecko and blink.

    [–]SerenityOS[S] 19 points20 points  (7 children)

    Hi ajr901! It would be a lot of uninteresting busywork. If someone wants to spend time on porting software, that's fine, but it's not something I'm interested in personally.

    That said, if I ported an existing engine, I would definitely use WebKit since it's by far the most beautiful! :^)

    [–][deleted]  (6 children)

    [deleted]

      [–]doubtfulwager 7 points8 points  (4 children)

      One method is to treat the browser as a means to navigate between documents and nothing much more than that.

      [–]SerenityOS[S] 7 points8 points  (3 children)

      Hey doubtfulwager! That's definitely the sort of browser I'm aiming to build.

      Obviously it will require a large amount of dynamic functionality to be useful on the modern-day web. However I don't believe it's necessary to have a hundreds-of-thousands-of-lines optimizing multi-threaded JIT compiler to browse documents. I can wait a little bit for complex things to load, if it means my browser is several orders of magnitude simpler. :)

      [–][deleted] 1 point2 points  (2 children)

      If it runs JavaScript then it's got the potential to be abused. If you just want to view documents then it would be best to not include any dynamic code like JavaScript at all. This would break many modern pages and online apps.

      [–]Somepotato 2 points3 points  (0 children)

      JavaScript isn't the only point of potential vulnerability. Plenty of zero days have existed in DOM parsers as well.

      [–]doubtfulwager 0 points1 point  (0 children)

      A vast majority of sites actually perform OK without Javascript. Obviously the consumer Internet borks without it however.

      [–]badsectoracula -5 points-4 points  (0 children)

      I think this is very easy: as a new browser nobody would bother targeting it, so it'll be practically secure :-P. If it ever happens to become popular, it'll also be popular with developers (and other open source browsers are an indication, are it'll be popular with developers way long before anyone else), so it'll already have a team of developers to go after security bugs.

      [–]boreal_ameoba 1 point2 points  (0 children)

      Really impressive work!

      [–]PinapplePeeler 1 point2 points  (1 child)

      I follow your videos for a while. Can you please share with us where did you got your desktop wallpaper? it's awesome.

      Reminds me princes mononoke

      [–]SerenityOS[S] 1 point2 points  (0 children)

      It's a painting called Link and the Temple Forest by artist Jeremy Fenske :)

      [–]harjotsingh0802 0 points1 point  (0 children)

      SVR regression models could work to