Como os Emuladores Linux funcionam no Windows?

0

Obviamente, eles criam um ambiente linux para que aplicativos linux sejam executados no windows. Mas,

  • que tipo de técnicas são usadas para isso?
  • Existe algum mecanismo especial seguido?
por arulappan 26.07.2012 / 06:18

1 resposta

2

Não existem emuladores Linux

  • Se você está falando sobre o Cygwin, eles literalmente reimplementam todas as chamadas do sistema Unix em termos de chamadas API do Windows em um arquivo DLL especial do espaço do usuário. Programas compilados para o ambiente Cygwin, portanto, não podem ser executados de forma independente no Windows

    Cygwin consists of two parts: a dynamic-link library (DLL) as an API compatibility layer in the form of a C standard library providing a substantial part of the POSIX API functionality, and an extensive collection of software tools and applications that provide a Unix-like look and feel.

    ...

    Cygwin consists of a library that implements the POSIX system call API in terms of Win32 system calls, a GNU development toolchain (including GCC and GDB) to allow software development, and running of a large number of application programs equivalent to those on Unix systems

    https://en.wikipedia.org/wiki/Cygwin

  • Se você está falando sobre MSYS / MSYS2 ou MinGW, então eles não são um simulador em qualquer sentido. Os programas são compilados em binários nativos do Windows usando a biblioteca Microsoft C e podem ser executados sem nenhum ambiente especial

    Although both Cygwin and MinGW can be used to port Unix software to Windows, they have different approaches: Cygwin aims to provide a complete POSIX layer comprising a full implementation of all major Unix system calls and libraries. Compatibility is considered higher priority than performance. On the other hand, MinGW's priorities are simplicity and performance. As such, it does not provide certain POSIX APIs which cannot easily be implemented using the Windows API, such as fork(), mmap() and ioctl(). Applications written using a cross-platform library that has itself been ported to MinGW, such as SDL, wxWidgets, Qt, or GTK+, will usually compile as easily in MinGW as they would in Cygwin.

    https://en.wikipedia.org/wiki/MinGW#Comparison_with_Cygwin

  • No Windows 10, a MS introduziu windows-subsystem-for-linux que é realmente um simulador Linux e não um emulador, assim como Wine não é um emulador . Eles têm um componente especial do kernel para lidar com as chamadas do sistema Linux e convertê-los para a versão do Windows, a fim de executar binários nativos do Linux ELF sem recompilar

    WSL is a collection of components that enables native Linux ELF64 binaries to run on Windows. It contains both user mode and kernel mode components. It is primarily comprised of:

    • User mode session manager service that handles the Linux instance life cycle
    • Pico provider drivers (lxss.sys, lxcore.sys) that emulate a Linux kernel by translating Linux syscalls
    • Pico processes that host the unmodified user mode Linux (e.g. /bin/bash)

    WSLexecutesunmodifiedLinuxELF64binariesbyvirtualizingaLinuxkernelinterfaceontopoftheWindowsNTkernel.Oneofthekernelinterfacesthatitexposesaresystemcalls(syscalls).Asyscallisaserviceprovidedbythekernelthatcanbecalledfromusermode.BoththeLinuxkernelandWindowsNTkernelexposeseveralhundredsyscallstousermode,buttheyhavedifferentsemanticsandaregenerallynotdirectlycompatible.Forexample,theLinuxkernelincludesthingslikefork,open,andkillwhiletheWindowsNTkernelhasthecomparableNtCreateProcess,NtOpenFile,andNtTerminateProcess.

    https://blogs.msdn.microsoft.com/wsl/2016/04/22/windows-subsystem-for-linux-overview/

No passado, havia também o subsistema Microsoft POSIX e Windows Services para UNIX , mas eles não são feitos para rodar o Linux. Para obter mais informações, leia Suporte a POSIX e UNIX no Windows

    
por 01.08.2013 / 15:23