什么是Lisp图像? [英] What is a Lisp image?

查看:128
本文介绍了什么是Lisp图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从本质上讲,我想知道什么是Lisp图像?它是一块包含Lisp解释器和一个或多个程序的内存吗?

Essentially, I would like to know what a Lisp image is? Is it a slice of memory containing the Lisp interpreter and one or more programs or what?

推荐答案

Lisp映像作为转储的内存

图像通常是文件.它是Lisp系统内存的转储.它包含Lisp系统的所有功能(通常编译为机器代码),变量值,符号等.它是正在运行的Lisp的快照.

The image is usually a file. It is a dump of the memory of a Lisp system. It contains all functions (often compiled to machine code), variable values, symbols, etc. of the Lisp system. It is a snapshot of a running Lisp.

要创建映像,请先启动Lisp,使用一会儿,然后再转储映像(执行此操作的函数名称取决于实现).

To create an image, one starts the Lisp, uses it for a while and then one dumps an image (the name of the function to do that depends on the implementation).

使用Lisp图像

下一次重新启动Lisp时,人们可以使用转储的映像并大致返回到以前的状态.当转储图像时,还可以告诉Lisp开始转储图像时应执行的操作.这样一来,可以重新连接到服务器,再次打开文件,等等.

Next time one restarts Lisp, one can use the dumped image and gets a state back roughly where one was before. When dumping an image one can also tell the Lisp what it should do when the dumped image is started. That way one can reconnect to servers, open files again, etc.

要启动这样的Lisp系统,需要一个内核和一个映像.有时Lisp可以将两者都放在一个文件中,因此可执行文件既包含内核(具有某些运行时功能)又包含图像数据.

To start such a Lisp system, one needs a kernel and an image. Sometimes the Lisp can put both into a single file, so that an executable file contains both the kernel (with some runtime functionality) and the image data.

在Lisp机器(运行Lisp操作系统的计算机)上,一种引导加载程序(FEP,前端处理器)可以将映像(称为世界")加载到内存中,然后启动该映像.在这种情况下,没有内核,并且计算机上正在运行的只是这个Lisp映像,它包含所有功能(解释器,编译器,内存管理,GC,网络堆栈,驱动程序等).基本上,它是一个操作系统,位于单个文件中.

On a Lisp Machine (a computer, running a Lisp operating system) a kind of boot loader (the FEP, Front End Processor) may load the image (called 'world') into memory and then start this image. In this case there is no kernel and all that is running on the computer is this Lisp image, which contains all functionality (interpreter, compiler, memory management, GC, network stack, drivers, ...). Basically it is an OS in a single file.

某些Lisp系统会在转储映像之前优化内存.他们可能会进行垃圾回收,对内存中的对象进行排序等.

Some Lisp systems will optimize the memory before dumping an image. They may do a garbage collection, order the objects in memory, etc.

为什么要使用图片?

为什么要使用图片?它节省了加载时间,并且可以向预配置的Lisp系统提供应用程序代码和数据给用户.使用保存的图像启动Common Lisp实现通常很快,在当前计算机上只需几毫秒.

Why would one use images? It saves time to load things and one can give preconfigured Lisp systems with application code and data to users. Starting a Common Lisp implementation with a saved image is usually fast - a few milliseconds on a current computer.

由于Lisp映像可能包含许多功能(编译器,甚至开发环境,大量调试信息等等),因此其大小通常为几兆字节.

Since the Lisp image may contain a lot of functionality (a compiler, even a development environment, lots of debugging information, ...) it is typically several megabytes in size.

在Lisp中使用图像与Smalltalk系统非常相似.例如,吱吱声还使用Smalltalk代码和数据的图像以及运行时可执行文件.有一个实际的区别:当前大多数Lisp系统都使用编译后的机器代码.因此,该映像无法在不同的处理器体系结构(x86,x86-64,SPARC,POWER,ARM等)之间或操作系统之间移植.

Using images in Lisp is very similar to what Smalltalk systems do. Squeak for example also uses an image of Smalltalk code and data and a runtime executable. There is a practical difference: most current Lisp systems use compiled machine code. Thus the image is not portable between different processor architectures (x86, x86-64, SPARC, POWER, ARM, ...) or even operating systems.

历史

这种Lisp图像已经使用很长时间了.例如,1967年的BBN Lisp中的函数SYSOUT创建了这样的图像. SYSIN会在开始时读取此类图像.

Such Lisp images have been in use since a long time. For example the function SYSOUT in BBN Lisp from 1967 created such an image. SYSIN would read such an image at start.

保存图像的功能示例

有关示例,请参见功能保存- LispWorks 的图片,或阅读SBCL 手册" rel ="noreferrer">保存核心图像.

For an example see the function save-image of LispWorks or read the SBCL manual on saving core images.

这篇关于什么是Lisp图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆