Microsoft and IBM have released MS-DOS 4.0 to the public under the MIT license, following the earlier release of versions 1.25 and 2.0. The source code for MS-DOS 4.0 is available on GitHub for educational and preservation purposes. It is now possible to run this version on modern computers using emulators like PCem and 86box. For more information, you can visit the Microsoft Open-Source Blog or access the source code directly on GitHub.
Keep in Mind MS-DOS 4.0 had bugs, leading to the more popular adoption of MS-DOS 5.0, which included bug fixes and new features. The key improvement in DOS 5 was the capability to utilize more than 640k of RAM. Lets hope they will make DOS 5 open source and that would have been a better decision.