首页 \ 问答 \ 当多个java程序在同一台机器上运行时(When multiple java programs run on the same machine)

当多个java程序在同一台机器上运行时(When multiple java programs run on the same machine)

每个Java应用程序将在特定的Java虚拟机实例中运行。 我在下面的方面真的很困惑,谷歌已经让我感到困惑了。 不同网站上的不同文章。

  1. 如果我有一个用Java编写的Web服务,那将需要一个JVM实例来运行。可以将JVM做成守护进程吗?

  2. 如果是的,当我们运行任何其他java应用程序,它将使用这个JVM实例或创建一个新的?

  3. 任何机器可用的主存储器都是常数。 当我们在不提供任何初始堆大小的情况下同时启动n个java进程时,堆大小如何在进程之间分配?

  4. 是否有任何管理n个JVM实例的进程或由操作系统本身管理?

  5. 在GC期间发生的其他事件是其他JVM实例(我假设的不同线程)受影响?


Each java application will run in a specific Java Virtual Machine Instance. I am really getting confused on below aspects and Googling has confused me even more. Different articles on different sites.

  1. If I have a web service written in java it will need a JVM instance to run.So can JVM be made a daemon process?

  2. If yes when we run any other java application it will use this instance of JVM or create a new one?

  3. Main memory available in any machine is constant. When we start n java processes simultaneously without providing any initial heap size how is the heap size distributed among processes?

  4. Is there any process that manages n number of JVM instances or is it managed by OS itself?

  5. When stop-the-world happens during an GC are other JVM instances(different threads I assume) affected?


原文:https://stackoverflow.com/questions/18394560
更新时间:2022-06-16 13:06

最满意答案

输出存在于单元格的特定上下文中,只要内核仍在运行,它仍然存在。 如果你需要保留输出,你仍然可以保存它。 例如在文件中或使用Pickle序列化。

您还可以使用命令行运行脚本,并将输出保存在另一个文件中:

jupyter nbconvert --to notebook --execute myfile.ipynb --output ./output/myfile.ipynb

在这个例子中,我运行myfile.ipynb并将输出(这是一个ipynb文件)保存在文件夹输出中。


The output exists in a specific context which is the cell and still exist as long as the kernel is still running. If you need to keep the output, you can still save it. For example in files or serialize it with Pickle.

You can also run your script with the command line and save the output in another file :

jupyter nbconvert --to notebook --execute myfile.ipynb --output ./output/myfile.ipynb

In this example, I run myfile.ipynb and save the output (which is an ipynb file) in the folder output.

相关问答

更多
  • 我刚刚发现, tabulate有一个HTML选项,使用起来相当简单。 与韦恩维尔纳的回答非常相似: from IPython.display import HTML, display import tabulate table = [["Sun",696000,1989100000], ["Earth",6371,5973.6], ["Moon",1737,73.5], ["Mars",3390,641.85]] display(HTML(tabulat ...
  • 据我所知,你不能激活另一个环境并使其工作。 你可以做的是明确地运行Python,类似 !/path/to/anaconda/envs/python2env/bin/python script_that_uses_python2.py 如果我跑步 !/path/to/anaconda/envs/python2env/bin/python -c "import sys; print sys.path" 在我的系统上,它只显示Python 2目录,所以它可能会找到正确的导入。 但是,该脚本中的变量在您的笔记本 ...
  • 尝试“内核 - >重新启动和全部运行”,然后点击“文件 - >保存和检查点” Try "Kernel -> Restart & Run All", then "File -> Save and Checkpoint"
  • 输出存在于单元格的特定上下文中,只要内核仍在运行,它仍然存在。 如果你需要保留输出,你仍然可以保存它。 例如在文件中或使用Pickle序列化。 您还可以使用命令行运行脚本,并将输出保存在另一个文件中: jupyter nbconvert --to notebook --execute myfile.ipynb --output ./output/myfile.ipynb 在这个例子中,我运行myfile.ipynb并将输出(这是一个ipynb文件)保存在文件夹输出中。 The output exists ...
  • 重新发布作为答案: hachoir_metadata模块似乎与stdout做了一些奇怪的事情,它破坏了IPython: Bug报告 。 如该链接所述,您需要在导入hachoir_metadata 之前添加以下代码: from hachoir_core import config config.unicode_stdout = False Reposting as an answer: The hachoir_metadata module appears to do something odd with ...
  • 是的,这是一个众所周知的问题。 编写Python时,大多数对象都会编写sys.stdout / sys.stderr对象,提供拦截钩子。 大多数编译库都没有尝试写入sys.stdin / sys.stdout ,他们只是打开文件描述符并写入它,你不能拦截它。 大部分时间它的东西都可以在底层库中修复,但是很多人都不愿意报错。 您将在启动笔记本电脑的终端中看到您的c ++输出。 关于如何“修复”这一点的想法,但它是非平凡的。 注意,您可以通过直接写入filedescriptor 1来重现,“blah”将出现在启 ...
  • 使用以下align_figures() : def align_figures(): import matplotlib from matplotlib._pylab_helpers import Gcf from IPython.display import display_html import base64 from ipykernel.pylab.backend_inline import show images = [] for figur ...
  • 希望jupyter人会解决这个问题。 但是,我找到了一个你现在可以使用的解决方法。 似乎新版本的jupyter笔记本可能没有在笔记本中显示stderr,而是将stderr发送到终端。 但是,他们仍然打印stdout。 您可以将根记录器的处理程序设置为stdout: import logging import sys # Get root logger (all other loggers will be derived from this logger's # properties) logger = l ...
  • 尝试结合ps aux|grep processName和kill pkill 。 pkill jupyter 应该完成这项工作。 如果它不起作用,请使用 pkill -9 jupyter 如果你想限制杀死只有你自己的进程,请尝试使用-u标志。 pkill -u `id -u` jupyter 如果需要的话,杀死可configurable-http-proxy因为它可能是文件。 运行。 这个问题似乎与jupyterhub团队开放,所以我认为它还没有被修复。 Try pkill which combin ...
  • 在主笔记本中它是不可能的(虽然有讨论),但有一个扩展应适合您的目的: http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/python-markdown/readme.html 它包含在ipython-contrib-extensions软件包中,其安装说明如下: http : //jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。