1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00
No description
Find a file
Liav A 9db291d885 Kernel: Introduce the new Time management subsystem
This new subsystem includes better abstractions of how time will be
handled in the OS. We take advantage of the existing RTC timer to aid
in keeping time synchronized. This is standing in contrast to how we
handled time-keeping in the kernel, where the PIT was responsible for
that function in addition to update the scheduler about ticks.
With that new advantage, we can easily change the ticking dynamically
and still keep the time synchronized.

In the process context, we no longer use a fixed declaration of
TICKS_PER_SECOND, but we call the TimeManagement singleton class to
provide us the right value. This allows us to use dynamic ticking in
the future, a feature known as tickless kernel.

The scheduler no longer does by himself the calculation of real time
(Unix time), and just calls the TimeManagment singleton class to provide
the value.

Also, we can use 2 new boot arguments:
- the "time" boot argument accpets either the value "modern", or
  "legacy". If "modern" is specified, the time management subsystem will
  try to setup HPET. Otherwise, for "legacy" value, the time subsystem
  will revert to use the PIT & RTC, leaving HPET disabled.
  If this boot argument is not specified, the default pattern is to try
  to setup HPET.
- the "hpet" boot argumet accepts either the value "periodic" or
  "nonperiodic". If "periodic" is specified, the HPET will scan for
  periodic timers, and will assert if none are found. If only one is
  found, that timer will be assigned for the time-keeping task. If more
  than one is found, both time-keeping task & scheduler-ticking task
  will be assigned to periodic timers.
  If this boot argument is not specified, the default pattern is to try
  to scan for HPET periodic timers. This boot argument has no effect if
  HPET is disabled.

In hardware context, PIT & RealTimeClock classes are merely inheriting
from the HardwareTimer class, and they allow to use the old i8254 (PIT)
and RTC devices, managing them via IO ports. By default, the RTC will be
programmed to a frequency of 1024Hz. The PIT will be programmed to a
frequency close to 1000Hz.

About HPET, depending if we need to scan for periodic timers or not,
we try to set a frequency close to 1000Hz for the time-keeping timer
and scheduler-ticking timer. Also, if possible, we try to enable the
Legacy replacement feature of the HPET. This feature if exists,
instructs the chipset to disconnect both i8254 (PIT) and RTC.
This behavior is observable on QEMU, and was verified against the source
code:
ce967e2f33

The HPETComparator class is inheriting from HardwareTimer class, and is
responsible for an individual HPET comparator, which is essentially a
timer. Therefore, it needs to call the singleton HPET class to perform
HPET-related operations.

The new abstraction of Hardware timers brings an opportunity of more new
features in the foreseeable future. For example, we can change the
callback function of each hardware timer, thus it makes it possible to
swap missions between hardware timers, or to allow to use a hardware
timer for other temporary missions (e.g. calibrating the LAPIC timer,
measuring the CPU frequency, etc).
2020-03-19 15:48:00 +01:00
.github Meta: Add GitHub Sponsors to funding options 2019-11-02 23:32:34 +01:00
AK AK: Add begin() and end() to String and StringView 2020-03-10 10:25:21 +01:00
Applications Calendar: Allow the widget to resize with the window 2020-03-19 09:55:14 +01:00
Base LibWeb: Fire "mousedown" and "mousemove" events in the DOM :^) 2020-03-18 17:13:22 +01:00
Demos LibCore: Make Core::Object::add<ChildType> return a ChildType& 2020-03-04 21:04:06 +01:00
DevTools HackStudio: Expand project tree view by default 2020-03-18 16:33:54 +01:00
Documentation Build: Use ccache if it's available (#1315) 2020-02-27 11:44:29 +01:00
Games Applications: Use "Document - AppName" window title format 2020-03-13 23:30:12 +01:00
Kernel Kernel: Introduce the new Time management subsystem 2020-03-19 15:48:00 +01:00
Libraries Kernel & LibC: Add CLOCK_REALTIME constant 2020-03-19 15:48:00 +01:00
MenuApplets LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients 2020-03-04 14:26:16 +01:00
Meta Meta: Integrate Shellcheck into Travis 2020-02-10 10:46:25 +01:00
Ports Ports: Add zstd port 2020-03-14 22:25:22 +01:00
Servers SystemServer: Add WorkingDirectory support 2020-03-18 08:23:31 +01:00
Shell Shell: Validate only one directory is given to cd 2020-03-09 19:35:36 +01:00
Tests Kernel: Demonstrate race condition in clock_nanosleep 2020-03-03 20:13:32 +01:00
Toolchain Travis: Cache toolchain 2020-03-08 14:09:08 +01:00
Userland LibCore: Moved cal.cpp functions to DateTime 2020-03-18 08:17:01 +01:00
.clang-format Meta: Update .clang-format to not indent nested namespaces 2020-03-14 10:10:21 +01:00
.gitignore Demos: Add a dynamic linking demo to show off dlfcn methods 2020-01-01 17:48:41 +01:00
.travis.yml Travis: Cache toolchain 2020-03-08 14:09:08 +01:00
CODE_OF_CONDUCT.md Meta: Move code of conduct (lol) to a separate file 2019-10-23 10:05:06 +02:00
CONTRIBUTING.md Meta: Reference CodingStyle doc in CONTRIBUTING.md 2020-01-08 19:41:20 +01:00
INSTALL.md Meta: Update link to build instructions in INSTALL.md 2020-01-01 17:33:32 +01:00
LICENSE Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
Makefile Build: Use ccache if it's available (#1315) 2020-02-27 11:44:29 +01:00
Makefile.common Build: Build with -std=c++2a 2020-02-19 12:03:11 +01:00
Makefile.subdir Build: wrap make invocations with flock(1) 2019-12-28 21:09:33 +01:00
ReadMe.md Meta: Add more libraries to ReadMe.md 2020-03-14 20:03:27 +01:00

SerenityOS

Graphical Unix-like operating system for x86 computers.

Travis CI status

About

SerenityOS is a love letter to '90s user interfaces with a custom Unix-like core. It flatters with sincerity by stealing beautiful ideas from various other systems.

Roughly speaking, the goal is a marriage between the aesthetic of late-1990s productivity software and the power-user accessibility of late-2000s *nix. This is a system by us, for us, based on the things we like.

I (Andreas) regularly post raw hacking sessions and demos on my YouTube channel.

Sometimes I write about the system on my github.io blog.

I'm also on Patreon and GitHub Sponsors if you would like to show some support that way.

Screenshot

Screenshot as of 1133aca

Kernel features

  • x86 (32-bit) kernel with pre-emptive multi-threading
  • Hardware protections (SMEP, SMAP, UMIP, NX, WP, TSD, ...)
  • IPv4 stack with ARP, TCP, UDP and ICMP protocols
  • ext2 filesystem
  • POSIX signals
  • Purgeable memory
  • /proc filesystem
  • Pseudoterminals (with /dev/pts filesystem)
  • Filesystem notifications
  • CPU and memory profiling
  • SoundBlaster 16 driver
  • VMWare/QEMU mouse integration

System services

  • Launch/session daemon (SystemServer)
  • Compositing window server (WindowServer)
  • Text console manager (TTYServer)
  • DNS client (LookupServer)
  • Network protocols server (ProtocolServer)
  • Software-mixing sound daemon (AudioServer)
  • Desktop notifications (NotificationServer)
  • HTTP server (WebServer)
  • Telnet server (TelnetServer)

Libraries

  • C++ templates and containers (AK)
  • Event loop and utilities (LibCore)
  • 2D graphics library (LibGfx)
  • GUI toolkit (LibGUI)
  • Cross-process communication library (LibIPC)
  • HTML/CSS engine (LibWeb)
  • JavaScript engine (LibJS)
  • Markdown (LibMarkdown)
  • Audio (LibAudio)
  • PCI database (LibPCIDB)
  • Terminal emulation (LibVT)
  • Network protocols (HTTP) (LibProtocol)
  • Mathematical functions (LibM)
  • ELF file handing (LibELF)
  • POSIX threading (LibPthread)
  • Higher-level threading (LibThread)

Userland features

  • Unix-like libc and userland
  • Shell with pipes and I/O redirection
  • On-line help system (both terminal and GUI variants)
  • Web browser (Browser)
  • C++ IDE (HackStudio)
  • IRC client
  • Desktop synthesizer (Piano)
  • Various desktop apps & games
  • Color themes

How do I build and run this?

See the SerenityOS build instructions

Wanna chat?

Come hang out with us in #serenityos on the Freenode IRC network.

Author

Contributors

(And many more!) Feel free to append yourself here if you've made some sweet contributions. :)

License

SerenityOS is licensed under a 2-clause BSD license.