Quick viewing(Text Mode)

Windows Subsystem for Linux, Linux を食べた Windows

Windows Subsystem for , Linux Windows

2016-08-14 Nagisa unworks

1

Windows !?

1.1 Build 2016

2016 3 30 3 Build 2016 WWDC Build (Siri ) Line () Bash on Ubuntu on Windows10

1.1 Build 2016

bash /Linux 1 bash UbuntuLinux Windows10 *1

*1 https://channel9.msdn.com/Events/Build/2016/P488

1 1 Windows Bash !?

1.2

bash bash Windows UNIX Windows VMware Windows Linux Windows OS Apple OS X UNIX 1 BSD Mac bash Bash on Windows10 Windows bash Linux Linux Windows Windows10 Linux OS Windows Linux ? 20 BSD Apple OS X ?

1.3 ()

Windows OS X OS OS X Mach OS 3

1.2 OS X

2 1.3 ()

Safari Web () () CPU () &OS ( ) Mach TCP/IP Mach BSD I/O Kit 60 Mach OS UNIX OS OS OS Mac iPhone 1 OS

1.3 OS

Mach Mach 2.5 Mach

3 1 Windows Bash !?

1.4 Mach 3.0 1

Mach 3.0 OS OS *2 90 OS *3 Mach 3.0 Mach 90 00 Apple Mach Mach OS X *4 Mach OS OS WindowsNT WindowsNT OS Windows 2000, WindowsXP OS WindowsNT , 10 2 OS bash

*2 GNU Hurd *3 IBM WorkplaceOS IBM PC OS OS/2 CPU PowerPC CHRP OS/2 PowerPC Apple MacOS Mac DOS OS 2000 *4 OS X Mach 3.0

4 1.4 OS X Windows

1.4 OS X Windows

OS X BSD Mach CoreService (Carbon) Cocoa BSD 90 00 PowerMac CPU OS Mach + BSD OS NEXT Software OS GPU 10.2 Jaguar 10.3 Panther OS MS-DOS OS Windows 3.1 OS OS Windows95 OS IBM OS/2 POSIX OS Windows API WindowsNT Windows Win32 WindowsNT Win32 OS/2 POSIX *5 OS

1.5 WindowsNT OS

Windows 2000, WindowsXP OS/2

*5 POSIX UNIX 1 10.5 Leopard OS X POSIX OS

5 1 Windows Bash !?

Win32 (GDI ) POSIX *6 Service For Unix (SFU) WindowsXP OS X OS

1.6 NT4, XP GDI Win32 Vista

*7 OS

1.5 for Linux, Linux

Bash on Windows10Linux Win- dows Subsystem for LinuxWSLOS X BSD bash Bash on Windows10 Linux bash Linux ELF Linux Linux Linux Win32 Linux root Linux /mnt// C Linux Linux

*6 *7 Vista

6 1.6 Windows10 OS?

1.6 Windows10 OS?

MacBook UNIX Office Windows UNIX Linux OS X iOS X Code Eclips Visual Studio OS X BSD BSD socket BSD launchd ASL BSD FreeBSD NetBSD BSD UNIX Lion El Capitan rootless UNIX Windows Linux Win32 Windows Windows Linux Linux OS X OS X OSS homebrew OS X Linux Ubuntu Linux Ubuntu apt Windows OS X Windows10

7 2

WSL

Windows Service for Linux Windows POSIX UNIX

2.1 Windows

Mach OS WindowsNT Windows NT Executive Windows Win32 OS/2 OS/2 POSIX POSIX Interix Win32 Win32 API NTFS IO POSIX OS/2 Win32

2.1 Win32 (ConHost)

8 2.2 Service for Unix (SFU) Interix

POSIX GUI POSIX XWindowSystem Win32 *1 X Windows GUI

:Win64? Wikipedia 64bit Windows Win64 API Win64 Web Win64 subsystem Wikipedia WoW64 Win64 Windows2000 WindowsXP, Windows 2003 OS Win64

2.2 Service for Unix (SFU) Interix

WindowsNT POSIX POSIX NFS LPD Srevice for UNIX (SFU) POSIX API POSIX Interix WindowsNT 3.1 PC UNIX SystemV POSIX POSIX Service For UNIX *2 POSIX Service For UNIX

*1 Windows X 0.7.x 6.9.0.31 Linux Oracle Java GUI *2 20 UX/OS (NEC SystemV UNIX) C WindowsNT POSIX

9 2 WSL

Softway Systems Interix Softway Systems Service For Unix 3.0 Interix Service For UNIX 3.5 WindowsServer 2003 WindowsXP Windows UNIX Cygwin LPD NFS Windows SFU Service for UNIX Applications (SUA) SUA WindowsServer 2012

2.2 WindowsServer

2.3 (PE)

SFU UNIX ? SFU Linux UNIX SFU Portable ExecutablePE PE Windows *3 WindowsNT Windows PE PE POSIX PE Linux ELF Windows ELF Interix Linux Ubuntu Linux

*3 OS, MS-DOS Windows3.1 COM,EXE x86 CPU AT&T SystemV UNIX COFF PE COM,EXE x86 CPU

10

3

WSL

Windows10 Windows Subsystem for Linux

3.1 WSL

Windows10 8/2 Anniversary Update *1Windows Windows Subsystem for Linux(Beta) Linux Windows10

3.1 Windows

[] Windows WSL Beta *2

*1 8/2 Windows10 2 1607 Build 14393 *2 Windows SSH SSH

11 3 WSL

3.2

Bash on Ubuntu on Linux Bash WSL Yes Ubuntu Windows10 10 bash.exe WSL 10 Ubuntu bash

3.3 Bash on Ubuntu on Windows

\Win- dows\system32\bash.exe bash bash.exe Win32 WSL

12 3.1 WSL

3.4 bash.exe

bash.exe WSL LX- Core.DLL LXSS.DLL Lx Session Man- ager(LxssManager)

3.5 Lx Session Manager LxssManager

LXSS pico process () Ubuntu init *3 init bash /etc/passwd bash LxssManager (ConHost)

*3 init systemd Upstart

13 3 WSL

3.6 Linux

bash.exe bash cmd.exe ( .exe) \path\to\dirbash /mnt/c/path/to/dir Windows WSL WSL /mnt Windows

3.2 pico process

WSL pico process ELF pico process Microsoft Research Drawbridge 1.15 Windows

3.7 https://blogs.msdn.microsoft.com/wsl/2016/05/23/pico-process-overview/

Windows NT NTDLL.DLL (TEB)

14 3.2 pico process

DLL Windows Windows10 Minimal Process Pico process

3.2.1 Minimal Process

Minimal Process CPU CPU Windows NT Windows10 Device Guard Minimal Process

3.2.2 Pico Process

Minimal Process () OS Windows OS Windows Linux x86-64 (x64) OS CPU sysenter syscall CPU sysenter sysenter OS CPU OS Minimal Process sysenter NT Pico Process Pico Provider sysenter Windows ... WSL LxCore, LXSS ( LxCore) Pico Provider Linux Windows Linux bash

15 3 WSL

bash.exe LxCore, LXSS NT LxssManager ()LxCore pico process ()LXSS LxssManager ELF init bash Linux CPU CPU

3.8 LxssManager LXSS picoprocess ELF

OS sysenter NT ()LxCore Linux ()LxCore Linux pico process LXSS LxssManager bash.exe

16 3.3 Gochas

3.9 picoprocess provider ()LxCore LxCore Linux

IO IO LxCore LXSS Win32/Win64 API Windows Linux Linux Windows10 NT +LxCore+LXSS

3.3 Gochas

IO IO Ubuntu apt-get cgroups Linux Windows Pico Process OS Win32 WSL WSL Linux Windows Windows WSL /etc/passwd /etc/shadow UID Windows bash.exe Ubuntu

17 3 WSL

3.10 HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss

lxrun.exe /setdefaultuser *4

3.11 lxrun

sudo /etc/sudoers sudo sudo Linux root /mnt/ Windows sudo Linux %userprofile%\AppData\Local\lxss\rootfs lxss rootfs %userprofile%\AppData\Local\lxss\ Linux /home (root /root )

3.12 rootfs Ubuntu

*4 lxrun /update WSL sudo apt-get update

18

Microsoft Linux Kernel Linux Azure Build Windows WindowsServer Docker Linux OSS OSS Microsoft Linux Windows Kerberos ...

19 Windows Subsystem for Linux, Linux Windows

Nagisa unworks

(C) 2016 Nagisa unworks Nagisa unworks.