⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unix to windows nt.txt

📁 本文是介绍如何从UNIX到NT程序的可移植技术,(国内是没有这方面的资料,所以是E文哦)
💻 TXT
📖 第 1 页 / 共 5 页
字号:



	   ################################################
	   #                                              #
	   # ##   ## ###### ####### ##    ## ## ##     ## #
	   # ##   ## ##  ## ##      ###   ## ##  ##   ##  #
	   # ##   ## ##     ##      ####  ## ##   ## ##   #
	   # ##   ## ###### ######  ## ## ## ##    ###    #
	   # ##   ##     ## ##      ##  #### ##   ## ##   #
	   # ##   ## ##  ## ##      ##   ### ##  ##   ##  #
	   # ####### ###### ####### ##    ## ## ##     ## #
	   #                                              #
	   ################################################



	 The following paper was originally published in the
       Proceedings of the 1997 USENIX Annual Technical Conference
		   Anaheim, California, January 6-10 1997.




	For more information about USENIX Association contact:

		   1. Phone:	510 528-8649
		   2. FAX:	510 548-5738
		   3. Email:	office@usenix.org
		   4. WWW URL:  http://www.usenix.org















                        Porting UNIX* to Windows NT

                    David G. Korn (dgk@research.att.com)

                             AT&T Laboratories
                          Murray Hill, N. J. 07974


                   Abstract               program to the native operating
                                          system  directly.  The openness
                                          meant   that    the    complete
        The    Software     Engineering   facilities    of   the   native
        Research  department  at Murray   operating      system      were
        Hill  writes  and   distributes   accessible     through     this
        several widely used development   environment.
        tools  and  reusable  libraries
        that    are   portable   across   The result of this effort is  a
        virtually       all        UNIX   set  of libraries, headers, and
        platforms.[1] To enhance  reuse   utilities that we  collectively
        of  these  tools and libraries,   refer   to   as   UWIN.    UWIN
        we want to make them  available   contains nearly all the  X/Open
        on   systems   running  Windows   Release      4[4]      headers,
        NT[2] and/or Windows 95[3].  We   interfaces  and  commands.   We
        did   not   want   to   support   discuss   alternative   porting
        multiple  versions   of   these   strategies,          commercial
        libraries,  and  we  wanted  to   products,     design     goals,
        minimize    the    amount    of   problems   that   had   to   be
        conditionally compiled code.      overcome,   and   the   current
                                          status.     Some    performance
        This paper describes an  effort   measurements  of  the   current
        of   trying  to  build  a  UNIX   system are presented here.
        interface layer on top  of  the
        Windows   NT   and  Windows  95
        operating system.  The goal was   1.  INTRODUCTION
        to  build  an  open environment
        rich enough to be both  a  good   The  marketplace  has  dictated
        development  environment  and a   the     need    for    software
        suitable execution environment.   applications  to  work   on   a
        This  meant  that  the overhead   variety   of  operating  system
        needed to be  small  enough  so   platforms.   Yet,   maintaining
        that  there was no incentive to   separate  source  code versions
                                          and  development   environments

        __________

          * UNIX is a registered trademark, licensed exclusively
            through X/Open, Limited.














        creates  additional expense and   to    the   WIN32   Application
        requires    more     programmer   Programming Interface (API)[7].
        training.                         The API for the WIN32 subsystem
                                          is also provided  with  Windows
        One way to lower this  cost  is   95,  although  not  all  of the
        to  use a middleware layer that   functions are implemented.   In
        hides the differences among the   most     instances     binaries
        operating systems.  The problem   compiled for  Windows  NT  that
        with this approach is  that  it   use the WIN32 API will also run
        forces  you  to  program  to  a   on Windows 95.
        non-standard,     and     often
        proprietary,   interface.    In   The  POSIX   subsystem   allows
        addition, it often  limits  you   applications  that are strictly
        to the least common denominator   conforming to  the  IEEE  POSIX
        of features  of  the  different   1003.1     operating     system
        operating systems.                standard[8] to run  on  Windows
                                          NT.   Since  the POSIX standard
        An alternative is  to  build  a   contains most of  the  standard
        middleware   layer   based   on   UNIX   system  call  interface,
        existing standards.   This  has   many UNIX utilities are  simple
        been  the  approach followed by   to  port  to  any POSIX system.
        IBM with  the  introduction  of   Because  most  of   our   tools
        OpenEdition[5]  for   the   MVS   require    only    the    POSIX
        operating      system,      URL   interface, we thought  that  it
        http://www.s390.ibm.com/products/owould  be  sufficient  to  port
        OpenEdition is X/Open compliant   them to the POSIX subsystem  of
        so that a large  collection  of   Windows  NT.  We were wrong for
        existing    software   can   be   the reasons  described  in  the
        transported at little cost.       next section.

        Windows  NT  is  an   operating   We   investigated   alternative
        system  developed  by Microsoft   strategies  that would allow us
        to fill the needs of the  high-   to run programs  on  both  UNIX
        end  market.   It  is a layered   and  Windows  NT based systems.
        architecture, designed from the   After  looking   at   all   the
        ground   up,   built  around  a   alternatives,   we  decided  to
        microkernel that is similar  to   write  our  own  library   that
        Mach.[6] One or more subsystems   would  make  porting to Windows
        can   reside   on  top  of  the   NT and  Windows  95  easy.   We
        microkernel which gives Windows   spent   three   months  putting
        NT the ability to run different   together  the  basic  framework
        logical    operating    systems   and getting some tools working.
        simultaneously.   For  example,   Realizing  that  the  task  was
        the OS/2 subsystem allows  OS/2   larger   than   a   one  person
        applications  to run on Windows   project, we contracted a  small
        NT.    The    most    important   development  team  of 2 or 3 to
        subsystem  that runs on Windows   do  portions  of  the  library,
        NT is the WIN32 subsystem.  The   packaging,  and  documentation.
        WIN32    subsystem   runs   all   This paper will discuss porting
        applications that  are  written   alternatives, the goals for our













        library, the issues  that  need   work to  overcome  some  subtle
        to   be   addressed,   and  the   differences.   In addition, the
        implementation  of  our   POSIX   resulting code may have a large
        library.   Finally,  we present   amount     of     conditionally
        some  performance  results  and   compiled code that is  hard  to
        future directions.                test and maintain.

                                          A third strategy  would  be  to
        2.  ALTERNATIVE_STRATEGIES        rewrite   the   code   using  a
                                          framework  which   provides   a
        Six  basic  strategies  can  be   virtual    system    interface.
        employed  to port existing UNIX   There are several vendors  that
        based applications  to  Windows   offer           object-oriented
        NT.   The  first strategy is to   application  layer   interfaces
        rewrite  the  code  using   the   that  encapsulate the operating
        WIN32 API.  This strategy makes   system  and  therefore   enable
        sense   if   there    are    no   applications    to    work   on
        requirements to continue to run   multiple  systems.   There  are
        on a UNIX  system.   Otherwise,   three    drawbacks    to   this
        this   strategy   will   either   approach.   First  of  all,  it
        require  two  sets  of   source   requires   a   large  up  front
        (which  will most likely be too   investment.  Secondly, you will
        expensive to maintain)  or  the   be  locked  into  the  vendors'
        use   of   a   WIN32  emulation   libraries and not able to  take
        library  that  runs   on   UNIX   advantage   of   savings   that
        platforms.   There are at least   result    from     competition.
        two vendors that have WIN32 API   Finally,  you  will  likely  be
        libraries for UNIX systems.  We   restricted to the  intersection
        ruled out this approach because   of  features  available  on the
        of  the  effort  to rewrite the   underlying platforms.
        code  to  the  WIN32  API   and
        because  the  WIN32 API is more   A fourth strategy  is  to  port
        complex than the X/Open API.      the  application  to  the POSIX
                                          subsystem of Windows  NT.   The
        The second strategy is  to  use   POSIX  subsystem  can  run  any
        the    Microsoft   C   library.   strictly conforming IEEE  POSIX
        Microsoft supplies a library of   application    program.    This
        routines  that  are  similar to   strategy  should  not   require
        their UNIX  counterparts.   You   major   investment,   and   any
        could  then  make modifications   investment that you make should
        to    your    application    as   increase   the  portability  of
        necessary   where   the   calls   your application to other POSIX
        differ  from  the  UNIX   call.   conforming             systems.
        This  strategy has been used by   Unfortunately, this  is  not  a
        at least  one  commercial  UNIX   viable   alternative  for  most
        tools  vendor to port GNU based   applications.   Microsoft   has
        tools  to  Windows  NT.   While   made  the  POSIX  subsystem  as
        this  strategy  is  appropriate   useless as possible  by  making
        for  some  applications,  other   it  a  closed system.  There is
        applications  may  require much   no way to access  functionality













        outside   of   the  1990  POSIX   A  sixth  and  final   strategy
        1003.1 standard from within the   would  be  to  write  your  own
        POSIX  subsystem, either at the   POSIX library using  the  WIN32
        library level or at the command   API.   After  investigating the
        level.   Thus,  you cannot even   other  alternatives,  this   is
        invoke the Microsoft C compiler   what  we decided to do.  We are
        from     within    the    POSIX   convinced  that  this  was  the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -