tabnine

TabNine

This is the repository for the backend of TabNine, the all-language autocompleter.
There are no source files here because the backend is closed source.

You can make feature requests by filing an issue. You are also welcome to make pull requests for changes to the configuration files.

languages.yml determines which file extensions are considered part of the same language. (For example, identifiers from .c files will be suggested in .h files.)

language_tokenization.json determines how languages are tokenized. For example, identifiers can contain dashes in Lisp, but not in Java.

If your feature request is specific to a particular editor’s TabNine client, please file an issue in one of these repositories:

You may be interested in these TabNine clients written by third parties:

Changelogs

If new features don’t work for you, check that you have the most recent version by typing TabNine::version into your text editor. If you don’t have the most recent version, try restarting your editor.

2.0.11 (August 24, 2019)

2.0.0 — 2.0.10 (July 15 — August 20, 2019)

  • Deep TabNine
  • Simplified bracket pairing logic
  • Simplified filesystem event handling
  • Added a configuration panel for viewing settings and logs which can be accessed by typing TabNine::config

1.0.14 (May 16, 2019)

  • TabNine no longer watches for filesystem events in ignored directories (closes #43).
  • TabNine now waits until a completion is requested to start the language server (closes #50).
  • Files with the .d extension are now recognized as D source files (closes #56).
  • Added LSP default configuration for PureScript.
  • Fixed a logic error that caused index size to be tracked incorrectly in some cases.

1.0.10 (December 1, 2018)

  • Fixed an internal logic error which could put indexing threads into a bad state, leading to an infinite loop (might close #24, we’ll see).
  • TabNine now considers a wider range of possibilities when completing in a zero-char context (i.e. when there are no characters immediately before the cursor).
  • TabNine now includes - in identifiers when parsing Racket code.

1.0.9 (November 27, 2018)

  • TabNine now uses the context after the cursor to filter its suggestions. For example, if there are tokens on the same line as the cursor, TabNine will not make a suggestion ending in a semicolon (unless there are already instances in the codebase of semicolons occurring in the middle of a line).
  • TabNine removes tokens matching the regex \d.*[a-zA-Z].*\d.*[a-zA-Z] from the project index. This is supposed to prevent long keys or base64 literals from occurring in autocompletion suggestions. The tokens are not filtered from the directory index or the file index.
  • TabNine now recognizes .tsx files as TypeScript rather than .xml (closes #21).
  • TabNine only checks its version directory, not its target directory, when auto-updating or writing registration keys. (This fixes an issue associated with DOS path shortening.)

1.0.7 (November 20, 2018)

  • Semantic completion is added! This allows TabNine to integrate with any language server that implements the Language Server Protocol.
    • TabNine will integrate the language server’s suggestions with its own. For example, TabNine can suggest multi-token completions where the first token is provided by the language server.
    • TabNine queries the language server asynchronously. So, if the language server is slow, you will see TabNine’s results only. Continue typing to see the language server’s results.
    • TabNine passes along any type information or documentation provided by the language server. (The Sublime and VS Code clients are not yet updated to display the documentation; this is coming soon.)
    • See the semantic completion guide for configuration help.
  • Paid index size limit increased to 100 MB (from 15 MB).
  • Free index size limit increased to 400 KB (from 200 KB).
  • Improved indexing performance.
  • Increased license price to $49/$99 personal/business (from $29/$89).
  • TabNine now provides closing brackets for its suggestions (so if it suggests foo( it will additionally insert ) to the right of the cursor once the suggestion is accepted). The editor clients do not support this yet as it requires an upgrade to the communication protocol with TabNine; this is coming soon. Closes #11 as this is no longer an issue with the TabNine backend.
  • TabNine now searches all parents to find the project root rather than stopping at the first .git. This permits nested Git repositories (closes #5).
  • TabNine provides an API call to get the regex it uses to find identifiers (closes #7).
  • TabNine no longer indexes files in .git (closes #8).
  • TabNine now respects .tabnineignore files (closes #15).
  • TabNine allows disabling auto-update by typing TabNine::disable_auto_update into your text editor (closes #14).
  • TabNine no longer stores registration keys and config in same directory where it is installed. This should prevent registration keys and config from being overwritten by client updates (closes #10). You can type TabNine::config_dir to see where config files are being stored.

ace-combat7-skies-unknown

ACE COMBAT™ 7: SKIES UNKNOWN

《皇牌空战7》是由万代南梦宫开发的皇牌空战系列的正统续作,游戏回归皇牌空战系列的虚构世界观,游戏平台为PS4,Xbox one和PC,支持PSVR操作。

ACE COMBAT系列,是能让玩家能化身为王牌驾驶员,驾驶爱机在追求拟真天空的美丽空间内,享受360度自由飞行的爽快感、让玩家亲自判断状况并选择敌人来破坏的痛快感、享受克服难关达成感的飞行射击游戏。

本作是系列最新作品,依然由「PROJECT ACES」来担任开发。本作的主题是「天空革新」,游戏内立体包覆天空的云层会扩散,气流与雷云等环境变化会晃动机体并扰乱HUD,能让玩家更加「体验天空」。在受环境影响的新缠斗世界中,体验系列作中最具魅力的空中战斗跟速度感吧。

image.png

image.png

image.png

image.png

image.png

image.png

image.png

最低配置:
需要 64 位处理器和操作系统
操作系统: Windows 7 / 8 / 8.1 / 10 (64-bit OS required)
处理器: Intel Core i3-7100
内存: 4 GB RAM
显卡: NVIDIA GeForce GTX 750Ti(2GB)
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 50 GB 可用空间
声卡: DirectX 11 sound card

推荐配置:
需要 64 位处理器和操作系统
操作系统: Windows 7 / 8 / 8.1 / 10 (64-bit OS required)
处理器: Intel Core i5-7500
内存: 8 GB RAM
显卡: NVIDIA GeForce GTX 1060 (3GB)
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 50 GB 可用空间
声卡: DirectX 11 sound card

传送门

asmttpd

asmttpd

Web server for Linux written in amd64 assembly.

Features:

  • Multi-threaded.
  • No libraries required ( only 64-bit Linux ).
  • Very small binary, roughly 6 KB.
  • Quite fast.

What works:

  • Serving files from specified document root.
  • HEAD requests.
  • 200, 206, 404, 400, 413, 416
  • Content-types: xml, html, xhtml, gif, png, jpeg, css, js, svg, and octet-stream.

Planned Features:

  • Directory listing.

Current Limitations / Known Issues

  • Sendfile can hang if GET is cancelled.

Installation

Run make or make release for non-debug version.

You will need yasm installed.

Usage

./asmttpd /path/to/web_root port_number

Example: ./asmttpd ./web_root 8080

Changes

2019-04-22 : asmttpd - 0.4.4

  • Added SVG support.

2019-01-24 : asmttpd - 0.4.3

  • Added port number as parameter.

2017-10-18 : asmttpd - 0.4.2

  • Set REUSEADDR.

2017-10-17 : asmttpd - 0.4.1

  • Stack address bug fix.

2016-10-31 : asmttpd - 0.4

  • HEAD support.

2014-07-14 : asmttpd - 0.3

  • Added default document support.

2014-02-10 : asmttpd - 0.2

  • Added 400, 413, 416 responses.
  • Fixed header processing bug.

2014-02-07 : asmttpd - 0.1.1

  • Fixed 206 max length bug.
  • Commented out simple request logging, uncomment in main.asm to enable.

2014-02-06 : asmttpd - 0.1

  • Fixed SIGPIPE when transfer is cancelled.
  • Added a more useful error on bind failure.
  • Fixed 206 size calculation.
  • Combined seek & get file size system calls.

2014-02-05 : asmttpd - 0.09

  • Issue #8 fix. Crashes on long request paths.

2014-02-04 : asmttpd - 0.08

  • Added TCP corking.

2014-02-04 : asmttpd - 0.07

  • Removed thread pool after benchmarking, changed to an accept-per-thread model.

2014-02-04 : asmttpd - 0.06

  • Worker thread stack corruption bug fix.

2014-02-04 : asmttpd - 0.05

  • Changed 200 and 206 implementation to use sendfile system call.
  • Got rid of read/write buffer, changed request read buffer to standard 8KB.

2014-02-03 : asmttpd - 0.04

  • 200 now streams full amount

2014-02-01 : asmttpd - 0.03

  • Files are split if too large to fit into buffer.
  • Added 206 responses with Content-Range handling

2014-01-30 : asmttpd - 0.02

  • Added xml, xhtml, gif, png, jpeg, css, and javascript content types.
  • Changed thread memory size to something reasonable. You can tweak it according to available memory. See comments in main.asm
  • Added simple request logging.
  • Added removal of ‘../‘ in URL.

lazydocker

image.png

A simple terminal UI for both docker and docker-compose, written in Go with the gocui library.

CircleCI
Go Report Card
GolangCI
GoDoc
GitHub repo size
GitHub Releases
GitHub tag
homebrew

Gif

Demo

Minor rant incoming: Something’s not working? Maybe a service is down. docker-compose ps. Yep, it’s that microservice that’s still buggy. No issue, I’ll just restart it: docker-compose restart. Okay now let’s try again. Oh wait the issue is still there. Hmm. docker-compose ps. Right so the service must have just stopped immediately after starting. I probably would have known that if I was reading the log stream, but there is a lot of clutter in there from other services. I could get the logs for just that one service with docker compose logs --follow myservice but that dies everytime the service dies so I’d need to run that command every time I restart the service. I could alternatively run docker-compose up myservice and in that terminal window if the service is down I could just up it again, but now I’ve got one service hogging a terminal window even after I no longer care about its logs. I guess when I want to reclaim the terminal realestate I can do ctrl+P,Q, but… wait, that’s not working for some reason. Should I use ctrl+C instead? I can’t remember if that closes the foreground process or kills the actual service.

What a headache!

Memorising docker commands is hard. Memorising aliases is slightly less hard. Keeping track of your containers across multiple terminal windows is near impossible. What if you had all the information you needed in one terminal window with every common command living one keypress away (and the ability to add custom commands as well). Lazydocker’s goal is to make that dream a reality.

Requirements

  • Docker >= 1.13 (API >= 1.25)
  • Docker-Compose >= 1.23.2 (optional)

Installation

Homebrew

Normally lazydocker formula can be found in the Homebrew core but we suggest you to tap our formula to get frequently updated one. It works with Linux, too.

Tap:

1
brew install jesseduffield/lazydocker/lazydocker

Core:

1
brew install lazydocker

Binary Release (Linux/OSX)

You can manually download a binary release from the release page.

Automated install/update, don’t forget to always verify what you’re piping into bash:

1
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash

Go

Required Go version >= 1.8

1
go get github.com/jesseduffield/lazydocker

Arch Linux AUR

You can install lazydocker using your AUR package manager of choice or by running:

1
2
3
git clone https://aur.archlinux.org/lazydocker.git ~/lazydocker
cd ~/lazydocker
makepkg --install

A development version of the AUR package is also available

Docker

Docker Pulls
Docker Stars
Docker Automated

  1. Click if you have an ARM device

    • If you have a ARM 32 bit v6 architecture

      1
      2
      3
      4
      5
      docker build -t lazyteam/lazydocker \
      --build-arg BASE_IMAGE_BUILDER=arm32v6/golang \
      --build-arg GOARCH=arm \
      --build-arg GOARM=6 \
      https://github.com/jesseduffield/lazydocker.git
    • If you have a ARM 32 bit v7 architecture

      1
      2
      3
      4
      5
      docker build -t lazyteam/lazydocker \
      --build-arg BASE_IMAGE_BUILDER=arm32v7/golang \
      --build-arg GOARCH=arm \
      --build-arg GOARM=7 \
      https://github.com/jesseduffield/lazydocker.git
    • If you have a ARM 64 bit v8 architecture

      1
      2
      3
      4
      docker build -t lazyteam/lazydocker \
      --build-arg BASE_IMAGE_BUILDER=arm64v8/golang \
      --build-arg GOARCH=arm64 \
      https://github.com/jesseduffield/lazydocker.git

  2. Run the container

    1
    2
    3
    4
    docker run --rm -it -v \
    /var/run/docker.sock:/var/run/docker.sock \
    -v /yourpath:/.config/jesseduffield/lazydocker \
    lazyteam/lazydocker
    • Don’t forget to change /yourpath to an actual path you created to store lazydocker’s config

    • You can also use this docker-compose.yml

    • You might want to create an alias, for example:

      1
      echo "alias lzd='docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /yourpath/config:/.config/jesseduffield/lazydocker lazyteam/lazydocker'" >> ~/.zshrc

For development, you can build the image using:

1
2
3
4
5
6
7
git clone https://github.com/jesseduffield/lazydocker.git
cd lazydocker
docker build -t lazyteam/lazydocker \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VERSION=`git describe --abbrev=0 --tag` \
.

If you encounter a compatibility issue with Docker bundled binary, try rebuilding
the image with the build argument --build-arg DOCKER_VERSION="v$(docker -v | cut -d" " -f3 | rev | cut -c 2- | rev)"
so that the bundled docker binary matches your host docker binary version.

Usage

Call lazydocker in your terminal. I personally use this a lot so I’ve made an alias for it like so:

1
echo "alias lzd='lazydocker'" >> ~/.zshrc

(you can substitute .zshrc for whatever rc file you’re using)

  • Basic video tutorial here.
  • List of keybindings
    here.

Cool features

everything is one keypress away (or one click away! Mouse support FTW):

  • viewing the state of your docker or docker-compose container environment at a glance
  • viewing logs for a container/service
  • viewing ascii graphs of your containers’ metrics so that you can not only feel but also look like a developer
  • customising those graphs to measure nearly any metric you want
  • attaching to a container/service
  • restarting/removing/rebuilding containers/services
  • viewing the ancestor layers of a given image
  • pruning containers, images, or volumes that are hogging up disk space

Contributing

There is still a lot of work to go! Please check out the contributing guide.
For contributor discussion about things not better discussed here in the repo, join the slack channel

Slack

If you would like to support the development of lazydocker, please donate

Donate

Social

If you want to see what I (Jesse) am up to in terms of development, follow me on
twitter or watch me program on
twitch

FAQ

How do I edit my config?

By opening lazydocker, clicking on the ‘project’ panel in the top left, and pressing ‘o’ (or ‘e’ if your editor is vim). See Config Docs

How do I get text to wrap in my main panel?

In the future I want to make this the default, but for now there are some CPU issues that arise with wrapping. If you want to enable wrapping, use gui.wrapMainPanel: true

How do you select text?

Because we support mouse events, you will need to hold option while dragging the mouse to indicate you’re trying to select text rather than click on something. Alternatively you can disable mouse events via the gui.ignoreMouseEvents config value

Does this work with Windows?

Currently not unless you use WSL. Instructions for setting up docker for WSL can be found here here

Why can’t I see my container’s logs?

By default we only show logs from the last hour, so that we’re not putting too much strain on the machine. This may be why you can’t see logs when you first start lazydocker. This can be overwritten in the config’s commandTemplates

If you are running lazydocker in Docker container, it is a know bug, that you can’t see logs or CPU usage.

Alternatives

  • docui - Skanehira beat me to the punch on making a docker terminal UI, so definitely check out that repo as well! I think the two repos can live in harmony though: lazydocker is more about managing existing containers/services, and docui is more about creating and configuring them.
  • Portainer - Portainer tries to solve the same problem but it’s accessed via your browser rather than your terminal. It also supports docker swarm.

copying-codes-from-stack-overflow

从 Stack Overflow 复制代码导致 GitHub 项目漏洞多

现在从网上找代码直接复制到项目中的做法成为程序员的一种常规操作,Stack Overflow 更是其中主要的代码来源。但是最近有研究显示,从 Stack Overflow 上复制代码凑到项目中会使出现漏洞的概率大大增加。

image.png

研究人员分析了 1325 个 Stack Overflow 帖子,并获取了其中 72 000 多段 C++ 代码,发现了其中包含有 29 种类型的 69 个漏洞。

这些漏洞出现在 2589 个 GitHub 仓库中,研究人员通知了受影响的 GitHub 项目作者,但只有少数人选择修复已知这些危险情况。

研究人员展示了含有漏洞的代码主要是以什么方式从 Stack Overflow 进入到 GitHub 中的,包括最经常发现的输入验证不正确、异常或异常情况的不正确检查与错误编码,比如复制代码不完整。

详情查看:

https://fossbytes.com/copying-codes-from-stack-overflow-leads-to-vulnerable-github-project

paper-e-database

写论文不用愁,50个全球免费电子数据库了解下(纯文字版)

最近人民日报小编很给力,整理了50个找文献资料的中外全球电子数据库,无论你是写毕业论文还是学术论文,总有一款适合你,快先收藏起来,查尔斯沃思小编将其整理成纯文字,方便作者检索,码字不易,多行点赞鼓励下吧!

中文数据库

  1. 国家哲学社会科学文献中心(上线文献数据超过1000万条)
    http://www.ncpssd.org
  1. 中西文科技文献服务平台
    http://lib.sstir.cn/
  1. 中国科技论文在线精品论文(自然科学领域的论文成果)
    http://highlights.paper.edu.cn/
  1. 中国国家图书馆馆藏中文图书数字化资源库(提供17万多种各学科的图书,可在线阅读)
    http://mylib.nlc.cn/web/guest/zhongwentushu
  1. 汉斯出版社中文学术期刊(提供125本国际开源中文期刊的免费下载阅读)
    http://www.hanspub.org
  1. 全国图书馆参考咨询联盟(绝大多数文献需要用邮箱传递)
    http://www.ucdrs.superlib.net/
  1. 国家科技图书文献中心(现有期刊资源6908本,会议资源1506个)
    http://www.nstl.gov.cn/
  1. 国家哲学社会科学学术期刊数据库(国内最大的公益性社科精品期刊数据库,收录精品学术期刊600多种,论文近300万篇)
    http://www.nssd.org/articles/articlesearch.aspx
  1. 中国科学院文献情报中心(国家科学图书馆)
    http://www.las.ac.cn/
  1. CALIS 高校学位论文库(免费文摘)
    http://opac.calis.edu.cn
  1. 中国国家数据(中国国家统计局提供的海量数据查询和下载的数据库,内容包含各个地区和国家的数据)
    http://data.stats.gov.cn/index.htm
  1. 中国国家图书馆(中国国家图书馆数字平台)
    http://www.nlc.gov.cn/

外文数据库

  1. ERIC 教育资源信息中心(教育资源数据库,部分资源可查找到全文)
    http://www.eric.ed.gov/
  1. Blackwell电子期刊(国际性期刊800余种,涵盖十多个学科,部分期刊提供全文)
    http://www.blackwell-synergy.com/
  1. 加拿大 AMICUS 学位论文(收录加拿大1300多个图书馆的学位论文信息)
    http://www.collectionscanada.gc.ca/theses-canada/index-e.html
  1. 欧洲学位论文库(收录来自欧洲28个国家的563所大学的开放学术资源)
    http://www.dart-europe.eu/basic-search.php
  1. Project Gutenberg(提供超过5万本免费电子书籍)
    http://www.gutenberg.org/

  2. 澳洲数字论文计划(包含澳洲40余所大学的15440篇硕博论文,涵盖各个学科)
    http://adt.caul.edu.au

  1. 北卡罗来纳州州立大学(3937篇免费博硕论文,涵盖化学、物理学、电子电气、核能、机械、材料、食品、林业、土壤等学科)
    https://repository.lib.ncsu.edu/handle/1840.20/23
  1. 加州大学学者文库(图书资源分对校内和校外两部分开放,著作新,制作质量高。普通读物、学术读物均有收录)
    http://publishing.cdlib.org/ucpressebooks/
  1. Directory of Open Access Journals(免费的全文科技学术期刊。现有2752种期刊,其中830种可以全文搜索。)
    http://www.doaj.org/
  1. Upcoming Conference(国内外学术会议论文)
    http://www.ourglocal.com/
  1. 俄亥俄州立大学电子学位论文(索引更新及时,可在线翻译成中文。涵盖机械、电子、管理、哲学、化学、环境学、材料、数学、物理等学科)
    http://www.ohiolink.edu/etd/search.cgi
  1. 美国密西根大学论文库(2万多篇期刊论文、技术报告、评论等文献全文)
    https://deepblue.lib.umich.edu/
  1. 开放存取资源图书馆(提供400多万篇免费使用下载的英文期刊论文,涵盖所有学科〉
    http://www.oalib.com
  1. Bioline International(提供发展中国家出版的高质量期刊)
    http://www.bioline.org.br
  1. 诺丁汉大学论文库(提供诺丁汉大学博士、硕士的研究、会议论文)
    http://eprints.nottingham.ac.uk/
  1. HINARI(世界卫生组织建立,提供生物医学与卫生文献的项目,包括3280种期刊)
    http://www.who.int/hinari/en/
  1. HighWire 出版社电子期刊(美国斯坦福大学著名的学术出版商,其中将近240万篇文章可免费获得全文)
    http://highwire.stanford.edu/lists/freeart.dtl
  1. 美国科学院院报(世界上被引用次数最多的综合学科刊物之一,继Nature、Science之后,在SCI综合学科类排名第三位)
    http://www.pnas.org/
  1. 科研出版社 OA 资源(共有180多种期刊的电子版本,文章超过10000篇)
    http://www.scirp.org/journal/
  1. Science Direct(SCI论文检索,收录超过25万篇论文)
    https://www.sciencedirect.com/

33 .华盛顿大学学位论文库(提供免费的电子书籍、论文、期刊,全文免费下载)
https://library.wustl.edu/

  1. 加拿大国家研究委员会( NRC) 0A 期刊(农业科学、生物信息学、生命科学、环境、纳米技术、分子科学、光电子科学等领域的学术性期刊)
    http://www.nrcresearchpress.com/
  1. Socolar(整理了世界上重要的0A期刊10000多种和1000多种0A仓贮资源)
    http://www.socolar.com/
  1. 加利福尼亚大学国际和区域数字馆藏(已出版的期刊论文、未出版的研究手稿、会议文献以及其他出版物上的文章1万多篇,均可免费阅读)
    http://repositories.cdlib.org/escholarship/
  1. 剑桥大学机构知识库(提供剑桥大学相关的期刊、学术论文、学位论文等电子资源)
    http://www.dspace.cam.ac.uk/
  1. Electronic library(提供超过270万本图书,超过5千万篇论文)
    http://b-ok.org/

39.Science 数据库(权威科研杂志《Science》官方网站,免费注册后可下载1997年以前的论文全文)
http://www.sciencemag.org/

  1. CERN Document Server(主要覆盖物理学及相关学科,提供36万多篇全文文献)
    http://cdsweb.cern.ch/
  1. 康奈尔大学ArXiv(面向物理学、数学、非线性科学、计算机科学和定量生物学等学科,提供16种免费电子期刊的访问)
    http://arxiv.org
  1. Energy Citations Database(提供美国能源部的科技信息摘要)
    http://www.osti.gov/energycitations/
  1. 约翰威立国际出版公司(收录了来自1500余种期刊、10000多本在线图书以及数百种多卷册的参考工具书、丛书系列、手册和辞典、实验室指南和数据库的400多万篇文章)
    http://onlinelibrary.wiley.com/
  1. 伍斯特工学院数据库(670余篇学位论文 ,其 中有550多篇全文。涵盖生物、电子、计算机、材料、物理、机械等学科)
    http://www.wpi.edu/Pubs/ETD/
  1. nature官网网站(在《 nature 》上在线发表的论文可以免费查看)
    https://www.nature.com/
  1. Social Science Research Network(社会科学(经济类)研究论文数据库,部分提供全文)
    http://www.ssrn.com/
  1. 美国医学学术资料网站(由美国国家医学图书馆和国立卫生研究院建立一个医学学术资料网站。生物医学文献超过2100万,包括
    论文参考文献,生命科学期刊,在线图书)
    https://www.ncbi.nlm.nih.gov/pubmed
  1. 世界数字图书馆(以多语种形式免费提供源于世界各地各文化的重要原始材料)
    http://www.wdl.org/zh/
  1. Manybooks(国外大量免费电子图书,可下载)
    http://manybooks.net/
  1. Aminer(收集了300万篇论文信息、3700多万引用关系以及8000多个会议信息)
    https://cn.aminer.org/

以上内容来源人民日报,查尔斯沃思作者服务将图片转换文字,转载需注明原作者及整理者。

windows.edb_mv

【Win10瘦身技巧】把索引文件Windows.edb移动到非系统盘

先介绍Windows.edb是什么东东,很奇怪的后缀名哦。其实它就是Windows10为加快搜索速度而建立的索引文件,所以还是很有用的,但是看看它的体积,你就会觉得也太占系统盘的空间了。Windows.edb文件所在的路径为:

1
C:\ProgramData\Microsoft\Search\Data\Applications\Windows

image.png

虽然我们可以删除该文件,但正像前面说过的,它还是比较有用的(并且删除后,再次使用搜索功能后,它还会生成的),所以我们最好保留着它,但可以移动一下Windows.edb文件的位置,把它移动到非系统盘。方法如下:

  1. 在Win10任务栏的Cortana搜索框中输入“索引选项”,点击搜索结果中的“索引选项(控制面板)”打开“索引选项”窗口。
  2. 点击窗口底部的“高级”按钮,打开“高级选项”窗口。
  3. 在“索引位置”区域点击右下角的“选择新位置”按钮,为Windows.edb选择非系统盘的路径即可。最后点击“确定”,重启电脑后生效。

lianhuafeng

莲花峰(安徽境内山峰)

莲花峰,是黄山风景区境内第一高峰,为36大峰之首,海拔1864.8米。位于登山步道玉屏楼到鳌鱼峰之间。莲花峰登峰盘道5里,相对高度110米。1997年,莲花沟开辟500米登山新道,由蹬道、栈桥、观景台等组成。

莲花峰峻峭高耸,气势雄伟。因主峰突兀,小峰簇拥,俨若新莲初开,仰天怒放,故名“莲花峰”。“登峰起步缓坡称“莲梗”,中间穿过四个石洞,古人称“莲孔”。洞穴陡立,游人叠级而上,如在莲孔中穿行,恰似“倾曲作蚁旋出花萼中”。沿途风光奇绝,峰壁间有“真好造化”、“非人间也”、“名不虚传”、“天海奇观”等摩崖题刻。峰下有莲花洞、莲花源。

明代吴怅曾有诗赞曰:“一种青莲吐绛霞,亭亭玉立净无瑕。遥看天际浮云卷,露出峰顶十丈花。”清代吴梦印亦有诗云:“莲峰秀拔迥称尊,凡欲高呼达帝阍。举目江山如带砺,低头峦蚰似儿孙。风生绝献应回雁,日落悬岩不度猿。翠影岚光千万状,我虽能到未能言。”连接莲花岭和莲花峰的是一条长达一公里半的蜿蜒小道,在到达峰顶前要过四个洞穴。
莲花峰上既有许多或似飞龙或似双龙的松树,也有著名的黄山杜鹃花 [1] 。

weilibipei

违例匹配

“掷”出一个违例后,违例控制系统会按当初编写的顺序搜索“最接近”的控制器。一旦找到相符的控制器,就认为违例已得到控制,不再进行更多的搜索工作。

在违例和它的控制器之间,并不需要非常精确的匹配。一个衍生类对象可与基础类的一个控制器相配,如下例所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//: Human.java
// Catching Exception Hierarchies

class Annoyance extends Exception {}
class Sneeze extends Annoyance {}

public class Human {
public static void main(String[] args) {
try {
throw new Sneeze();
} catch(Sneeze s) {
System.out.println("Caught Sneeze");
} catch(Annoyance a) {
System.out.println("Caught Annoyance");
}
}
} ///:~

Sneeze违例会被相符的第一个catch从句捕获。当然,这只是第一个。然而,假如我们删除第一个catch从句:

1
2
3
4
5
try {
throw new Sneeze();
} catch(Annoyance a) {
System.out.println("Caught Annoyance");
}

那么剩下的catch从句依然能够工作,因为它捕获的是Sneeze的基础类。换言之,catch(Annoyance e)能捕获一个Annoyance以及从它衍生的任何类。这一点非常重要,因为一旦我们决定为一个方法添加更多的违例,而且它们都是从相同的基础类继承的,那么客户程序员的代码就不需要更改。至少能够假定它们捕获的是基础类。

若将基础类捕获从句置于第一位,试图“屏蔽”衍生类违例,就象下面这样:

1
2
3
4
5
6
7
try {
throw new Sneeze();
} catch(Annoyance a) {
System.out.println("Caught Annoyance");
} catch(Sneeze s) {
System.out.println("Caught Sneeze");
}

则编译器会产生一条出错消息,因为它发现永远不可能抵达Sneeze捕获从句。

9.8.1 违例准则

用违例做下面这些事情:

(1) 解决问题并再次调用造成违例的方法。

(2) 平息事态的发展,并在不重新尝试方法的前提下继续。

(3) 计算另一些结果,而不是希望方法产生的结果。

(4) 在当前环境中尽可能解决问题,以及将相同的违例重新“掷”出一个更高级的环境。

(5) 在当前环境中尽可能解决问题,以及将不同的违例重新“掷”出一个更高级的环境。

(6) 中止程序执行。

(7) 简化编码。若违例方案使事情变得更加复杂,那就会令人非常烦恼,不如不用。

(8) 使自己的库和程序变得更加安全。这既是一种“短期投资”(便于调试),也是一种“长期投资”(改善应用程序的健壮性)

computer-vision-weekly-news-20191003

计算机视觉开源周报20191003期

总结了过去一周CV领域的最新开源代码,发现本周出现多份很有价值的高质量、重量级工作,比如致力于使得图卷积网络更深的DeepGCNs、Mask引导的注意力网络大大改进了遮挡行人重识别、格灵深瞳轻量级人脸识别比赛冠军模型VarGFaceNet、比LSTM更优的新RNN模型IndRNN、还有异常强大的字符级文本识别CharNet。

image.png

PLMpapers

PLMpapers

Contributed by Xiaozhi Wang and Zhengyan Zhang.

Introduction

Pre-trained Languge Model (PLM) is a very popular topic in NLP. In this repo, we list some representative work on PLM and show their relationship with a diagram. Feel free to distribute or use it! Here you can get the source PPT file of the diagram if you want to use it in your presentation.

image.png

Corrections and suggestions are welcomed.

We also released OpenCLap, an open-source Chinese language pre-trained model zoo. Welcome to try it.

Papers

Models

  1. Semi-supervised Sequence Learning. Andrew M. Dai, Quoc V. Le. NIPS 2015. [pdf]
  2. context2vec: Learning Generic Context Embedding with Bidirectional LSTM. Oren Melamud, Jacob Goldberger, Ido Dagan. CoNLL 2016. [pdf] [project] (context2vec)
  3. Unsupervised Pretraining for Sequence to Sequence Learning. Prajit Ramachandran, Peter J. Liu, Quoc V. Le. EMNLP 2017. [pdf] (Pre-trained seq2seq)`
  4. Deep contextualized word representations. Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee and Luke Zettlemoyer. NAACL 2018. [pdf] [project] (ELMo)
  5. Universal Language Model Fine-tuning for Text Classification. Jeremy Howard and Sebastian Ruder. ACL 2018. [pdf] [project] (ULMFiT)
  6. Improving Language Understanding by Generative Pre-Training. Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever. Preprint. [pdf] [project] (GPT)
  7. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova. NAACL 2019. [pdf] [code & model]
  8. Language Models are Unsupervised Multitask Learners. Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei and Ilya Sutskever. Preprint. [pdf] [code] (GPT-2)
  9. ERNIE: Enhanced Language Representation with Informative Entities. Zhengyan Zhang, Xu Han, Zhiyuan Liu, Xin Jiang, Maosong Sun and Qun Liu. ACL 2019. [pdf] [code & model] (ERNIE (Tsinghua) )
  10. ERNIE: Enhanced Representation through Knowledge Integration. Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Xuyi Chen, Han Zhang, Xin Tian, Danxiang Zhu, Hao Tian and Hua Wu. Preprint. [pdf] [code] (ERNIE (Baidu) )
  11. Defending Against Neural Fake News. Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, Yejin Choi. NeurIPS 2019. [pdf] [project] (Grover)
  12. Cross-lingual Language Model Pretraining. Guillaume Lample, Alexis Conneau. NeurIPS 2019. [pdf] [code & model] (XLM)
  13. Multi-Task Deep Neural Networks for Natural Language Understanding. Xiaodong Liu, Pengcheng He, Weizhu Chen, Jianfeng Gao. ACL 2019. [pdf] [code & model] (MT-DNN)
  14. MASS: Masked Sequence to Sequence Pre-training for Language Generation. Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu. ICML 2019. [pdf] [code & model]
  15. Unified Language Model Pre-training for Natural Language Understanding and Generation. Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, Hsiao-Wuen Hon. Preprint. [pdf] (UniLM)
  16. XLNet: Generalized Autoregressive Pretraining for Language Understanding. Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, Quoc V. Le. NeurIPS 2019. [pdf] [code & model]
  17. RoBERTa: A Robustly Optimized BERT Pretraining Approach. Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov. Preprint. [pdf] [code & model]
  18. SpanBERT: Improving Pre-training by Representing and Predicting Spans. Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S. Weld, Luke Zettlemoyer, Omer Levy. Preprint. [pdf] [code & model]
  19. Knowledge Enhanced Contextual Word Representations. Matthew E. Peters, Mark Neumann, Robert L. Logan IV, Roy Schwartz, Vidur Joshi, Sameer Singh, Noah A. Smith. EMNLP 2019. [pdf] (KnowBert)
  20. VisualBERT: A Simple and Performant Baseline for Vision and Language. Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang. Preprint. [pdf] [code & model]
  21. ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks. Jiasen Lu, Dhruv Batra, Devi Parikh, Stefan Lee. NeurIPS 2019. [pdf] [code & model]
  22. VideoBERT: A Joint Model for Video and Language Representation Learning. Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, Cordelia Schmid. ICCV 2019. [pdf]
  23. LXMERT: Learning Cross-Modality Encoder Representations from Transformers. Hao Tan, Mohit Bansal. EMNLP 2019. [pdf] [code & model]
  24. VL-BERT: Pre-training of Generic Visual-Linguistic Representations. Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, Jifeng Dai. Preprint. [pdf]
  25. Unicoder-VL: A Universal Encoder for Vision and Language by Cross-modal Pre-training. Gen Li, Nan Duan, Yuejian Fang, Ming Gong, Daxin Jiang, Ming Zhou. Preprint. [pdf]
  26. K-BERT: Enabling Language Representation with Knowledge Graph. Weijie Liu, Peng Zhou, Zhe Zhao, Zhiruo Wang, Qi Ju, Haotang Deng, Ping Wang. Preprint. [pdf]
  27. Fusion of Detected Objects in Text for Visual Question Answering. Chris Alberti, Jeffrey Ling, Michael Collins, David Reitter. EMNLP 2019. [pdf] (B2T2)
  28. Contrastive Bidirectional Transformer for Temporal Representation Learning. Chen Sun, Fabien Baradel, Kevin Murphy, Cordelia Schmid. Preprint. [pdf] (CBT)
  29. ERNIE 2.0: A Continual Pre-training Framework for Language Understanding. Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Hao Tian, Hua Wu, Haifeng Wang. Preprint. [pdf] [code]
  30. 75 Languages, 1 Model: Parsing Universal Dependencies Universally. Dan Kondratyuk, Milan Straka. EMNLP 2019. [pdf] [code & model] (UDify)
  31. Pre-Training with Whole Word Masking for Chinese BERT. Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, Ziqing Yang, Shijin Wang, Guoping Hu. Preprint. [pdf] [code & model] (Chinese-BERT-wwm)
  32. UNITER: Learning UNiversal Image-TExt Representations. Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, Jingjing Liu. Preprint. [pdf]
  33. HUBERT Untangles BERT to Improve Transfer across NLP Tasks. Anonymous authors. ICLR 2020 under review. [pdf]
  34. MultiFiT: Efficient Multi-lingual Language Model Fine-tuning. Julian Eisenschlos, Sebastian Ruder, Piotr Czapla, Marcin Kardas, Sylvain Gugger, Jeremy Howard. EMNLP 2019. [pdf] [code & model]

Knowledge Distillation & Model Compression

  1. TinyBERT: Distilling BERT for Natural Language Understanding. Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, Qun Liu. Preprint. [pdf]
  2. Distilling Task-Specific Knowledge from BERT into Simple Neural Networks. Raphael Tang, Yao Lu, Linqing Liu, Lili Mou, Olga Vechtomova, Jimmy Lin. Preprint. [pdf]
  3. Patient Knowledge Distillation for BERT Model Compression. Siqi Sun, Yu Cheng, Zhe Gan, Jingjing Liu. EMNLP 2019. [pdf] [code]
  4. Model Compression with Multi-Task Knowledge Distillation for Web-scale Question Answering System. Ze Yang, Linjun Shou, Ming Gong, Wutao Lin, Daxin Jiang. Preprint. [pdf]
  5. PANLP at MEDIQA 2019: Pre-trained Language Models, Transfer Learning and Knowledge Distillation. Wei Zhu, Xiaofeng Zhou, Keqiang Wang, Xun Luo, Xiepeng Li, Yuan Ni, Guotong Xie. The 18th BioNLP workshop. [pdf]
  6. Improving Multi-Task Deep Neural Networks via Knowledge Distillation for Natural Language Understanding. Xiaodong Liu, Pengcheng He, Weizhu Chen, Jianfeng Gao. Preprint. [pdf] [code & model]
  7. Well-Read Students Learn Better: The Impact of Student Initialization on Knowledge Distillation. Iulia Turc, Ming-Wei Chang, Kenton Lee, Kristina Toutanova. Preprint. [pdf]
  8. Small and Practical BERT Models for Sequence Labeling. Henry Tsai, Jason Riesa, Melvin Johnson, Naveen Arivazhagan, Xin Li, Amelia Archer. EMNLP 2019. [pdf]
  9. Q-BERT: Hessian Based Ultra Low Precision Quantization of BERT. Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W. Mahoney, Kurt Keutzer. Preprint. [pdf]
  10. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. Anonymous authors. ICLR 2020 under review. [pdf]
  11. Extreme Language Model Compression with Optimal Subwords and Shared Projections. Sanqiang Zhao, Raghav Gupta, Yang Song, Denny Zhou. Preprint. [pdf]
  12. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. Victor Sanh, Lysandre Debut, Julien Chaumond, Thomas Wolf. Preprint. [pdf]

Analysis

  1. Revealing the Dark Secrets of BERT. Olga Kovaleva, Alexey Romanov, Anna Rogers, Anna Rumshisky. EMNLP 2019. [pdf]
  2. How Does BERT Answer Questions? A Layer-Wise Analysis of Transformer Representations. Betty van Aken, Benjamin Winter, Alexander Löser, Felix A. Gers. CIKM 2019. [pdf]
  3. Are Sixteen Heads Really Better than One?. Paul Michel, Omer Levy, Graham Neubig. Preprint. [pdf] [code]
  4. Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment. Di Jin, Zhijing Jin, Joey Tianyi Zhou, Peter Szolovits. Preprint. [pdf] [code]
  5. BERT has a Mouth, and It Must Speak: BERT as a Markov Random Field Language Model. Alex Wang, Kyunghyun Cho. NeuralGen 2019. [pdf] [code]
  6. Linguistic Knowledge and Transferability of Contextual Representations. Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, Noah A. Smith. NAACL 2019. [pdf]
  7. What Does BERT Look At? An Analysis of BERT’s Attention. Kevin Clark, Urvashi Khandelwal, Omer Levy, Christopher D. Manning. BlackBoxNLP 2019. [pdf] [code]
  8. Open Sesame: Getting Inside BERT’s Linguistic Knowledge. Yongjie Lin, Yi Chern Tan, Robert Frank. BlackBoxNLP 2019. [pdf] [code]
  9. Analyzing the Structure of Attention in a Transformer Language Model. Jesse Vig, Yonatan Belinkov. BlackBoxNLP 2019. [pdf]
  10. Blackbox meets blackbox: Representational Similarity and Stability Analysis of Neural Language Models and Brains. Samira Abnar, Lisa Beinborn, Rochelle Choenni, Willem Zuidema. BlackBoxNLP 2019. [pdf]
  11. BERT Rediscovers the Classical NLP Pipeline. Ian Tenney, Dipanjan Das, Ellie Pavlick. ACL 2019. [pdf]
  12. How multilingual is Multilingual BERT?. Telmo Pires, Eva Schlinger, Dan Garrette. ACL 2019. [pdf]
  13. What Does BERT Learn about the Structure of Language?. Ganesh Jawahar, Benoît Sagot, Djamé Seddah. ACL 2019. [pdf]
  14. Beto, Bentz, Becas: The Surprising Cross-Lingual Effectiveness of BERT. Shijie Wu, Mark Dredze. EMNLP 2019. [pdf]
  15. How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddings. Kawin Ethayarajh. EMNLP 2019. [pdf]
  16. Probing Neural Network Comprehension of Natural Language Arguments. Timothy Niven, Hung-Yu Kao. ACL 2019. [pdf] [code]
  17. Universal Adversarial Triggers for Attacking and Analyzing NLP. Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, Sameer Singh. EMNLP 2019. [pdf] [code]
  18. The Bottom-up Evolution of Representations in the Transformer: A Study with Machine Translation and Language Modeling Objectives. Elena Voita, Rico Sennrich, Ivan Titov. EMNLP 2019. [pdf]
  19. Do NLP Models Know Numbers? Probing Numeracy in Embeddings. Eric Wallace, Yizhong Wang, Sujian Li, Sameer Singh, Matt Gardner. EMNLP 2019. [pdf]
  20. Investigating BERT’s Knowledge of Language: Five Analysis Methods with NPIs. Alex Warstadt, Yu Cao, Ioana Grosu, Wei Peng, Hagen Blix, Yining Nie, Anna Alsop, Shikha Bordia, Haokun Liu, Alicia Parrish, Sheng-Fu Wang, Jason Phang, Anhad Mohananey, Phu Mon Htut, Paloma Jeretič, Samuel R. Bowman. EMNLP 2019. [pdf] [code]
  21. Visualizing and Understanding the Effectiveness of BERT. Yaru Hao, Li Dong, Furu Wei, Ke Xu. EMNLP 2019. [pdf]
  22. Visualizing and Measuring the Geometry of BERT. Andy Coenen, Emily Reif, Ann Yuan, Been Kim, Adam Pearce, Fernanda Viégas, Martin Wattenberg. NeurIPS 2019. [pdf]
  23. On the Validity of Self-Attention as Explanation in Transformer Models. Gino Brunner, Yang Liu, Damián Pascual, Oliver Richter, Roger Wattenhofer. Preprint. [pdf]
  24. Transformer Dissection: An Unified Understanding for Transformer’s Attention via the Lens of Kernel. Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, Ruslan Salakhutdinov. EMNLP 2019. [pdf]
  25. Language Models as Knowledge Bases? Fabio Petroni, Tim Rocktäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H. Miller, Sebastian Riedel. EMNLP 2019, [pdf] [code]
  26. To Tune or Not to Tune? Adapting Pretrained Representations to Diverse Tasks. Matthew E. Peters, Sebastian Ruder, Noah A. Smith. RepL4NLP 2019, [pdf]

Tutorial & Resource

  1. Transfer Learning in Natural Language Processing. Sebastian Ruder, Matthew E. Peters, Swabha Swayamdipta, Thomas Wolf. NAACL 2019. [slides]
  2. Transformers: State-of-the-art Natural Language Processing. Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Jamie Brew. Preprint. [pdf] [code]

operating-system-knowledge-summary

操作系统面试重难点总结

针对操作系统,根据面试重难点总结以及网络上的一些参考,对操作系统面试知识点的总结与学习。

一、操作系统知识点图谱

image.png

二、面试问题总结

参考:面试复习重点——基础篇:操作系统、计算机网络、设计模式

1.操作系统的四个特性。
2.操作系统的主要功能。
3.进程的有哪几种状态,状态转换图,及导致转换的事件。
4.进程与线程的区别。
5.进程通信的几种方式。
6.进程同步的几种方式
7.用户态和核心态的区别。
8.死锁的概念,导致死锁的原因.
9.导致死锁的四个必要条件。
10.处理死锁的四个方式。
11.预防死锁的方法、避免死锁的方法。
12.进程调度算法。
13.内存连续分配方式采用的几种算法及各自优劣。
14.基本分页储存管理方式。
15.基本分段储存管理方式。
16.分段分页方式的比较各自优缺点。
17.几种页面置换算法,会算所需换页数
18.虚拟内存的定义及实现方式。

三、重难点总结

  1. 操作系统的四个特性
    并发:同一段时间内多个程序执行(注意区别并行和并发,前者是同一时刻的多个事件,后者是同一时间段内的多个事件)
    共享:系统中的资源可以被内存中多个并发执行的进线程共同使用
    虚拟:通过时分复用(如分时系统)以及空分复用(如虚拟内存)技术实现把一个物理实体虚拟为多个
    异步:系统中的进程是以走走停停的方式执行的,且以一种不可预知的速度推进

  2. 操作系统的主要功能
    处理机管理:处理机分配都是以进程为单位,所以处理机管理也被看做是进程管理。包括进程控制,进程同步,进程通信和进程调度
    存储器管理(或者内存管理):内存分配,内存保护,地址映射,内存扩充
    设备管理:管理所有外围设备,包括完成用户的IO请求;为用户进程分配IO设备;提高IO设备利用率;提高IO速度;方便IO的使用
    文件管理:管理用户文件和系统文件,方便使用同时保证安全性。包括:磁盘存储空间管理,目录管理,文件读写管理以及文件共享和保护
    提供用户接口:程序接口(如API)和用户接口(如GUI)

  3. 进程的状态与转换

image.png

运行状态:进程正在处理机上运行。在单处理机环境下,每一时刻最多只有一个进程处于运行状态。

就绪状态:进程已处于准备运行的状态,即进程获得了除处理机之外的一切所需资源,一旦得到处理机即可运行。

阻塞状态,又称等待状态:进程正在等待某一事件而暂停运行,如等待某资源为可用(不包括处理机)或等待输入/输出完成。即使处理机空闲,该进程也不能运行。

注意区别就绪状态和等待状态:就绪状态是指进程仅缺少处理机,只要获得处理机资源就立即执行;而等待状态是指进程需要其他资源(除了处理机)或等待某一事件。

就绪状态 -> 运行状态:处于就绪状态的进程被调度后,获得处理机资源(分派处理机时间片),于是进程由就绪状态转换为运行状态。

运行状态 -> 就绪状态:处于运行状态的进程在时间片用完后,不得不让出处理机,从而进程由运行状态转换为就绪状态。此外,在可剥夺的操作系统中,当有更高优先级的进程就 、 绪时,调度程度将正执行的进程转换为就绪状态,让更高优先级的进程执行。

运行状态 -> 阻塞状态:当进程请求某一资源(如外设)的使用和分配或等待某一事件的发生(如I/O操作的完成)时,它就从运行状态转换为阻塞状态。进程以系统调用的形式请求操作系统提供服务,这是一种特殊的、由运行用户态程序调用操作系统内核过程的形式。

阻塞状态 -> 就绪状态:当进程等待的事件到来时,如I/O操作结束或中断结束时,中断处理程序必须把相应进程的状态由阻塞状态转换为就绪状态。

  1. 进程与线程的区别
    进程:进程是进程实体的运行过程,是系统进行资源分配和调度的一个独立单位(具有动态、并发、独立、异步的特性,以及就绪、执行、阻塞3种状态);引入进程是为了使多个程序可以并发的执行,以提高系统的资源利用率和吞吐量。

线程:是比进程更小的可独立运行的基本单位,可以看做是轻量级的进程(具有轻型实体,独立调度分派单位,可并发执行,共享进程资源等属性);引入目的是为了减少程序在并发执行过程中的开销,使OS的并发效率更高。

两者的对比:

  • 调度方面:在引入线程的OS中,线程是独立的调度和分派单位,而进程作为资源的拥有单位(相当于把未引入线程的传统OS中的进程的两个属性分开了)。由于线程不拥有资源,因此可以显著的提高并发度以及减少切换开销。

  • 并发性:引入了线程的OS中,进程间可以并发,而且一个进程内部的多个线程之间也是可以并发的,这就使OS具有更好的并发性,有效的提高了系统资源利用率和吞吐量。

  • 拥有资源:无论OS是否支持线程,进程都是基本的资源拥有单位,线程只拥有很少的基本的资源,但是线程可以访问所隶属的进程的资源(进程的代码段,数据段和所拥有的系统资源如fd)

  • 系统开销:创建或者撤销进程的时候,系统要为之创建或回收PCB,系统资源等,切换时也需要保存和恢复CPU环境。而线程的切换只需要保存和恢复少量的寄存器,不涉及存储器管理方面的工作,所以开销较小。此外,统一进程中的多个线程由于共享地址空间,所以通信同步等都比较方便。

  1. 进程通信
    进程通信是指进程之间的信息交换。PV操作是低级通信方式,髙级通信方式是指以较高的效率传输大量数据的通信方式。高级通信方法主要有以下三个类。

共享存储

在通信的进程之间存在一块可直接访问的共享空间,通过对这片共享空间进行写/读操作实现进程之间的信息交换。在对共享空间进行写/读操作时,需要使用同步互斥工具(如 P操作、V操作),对共享空间的写/读进行控制。共享存储又分为两种:低级方式的共享是基于数据结构的共享;高级方式则是基于存储区的共享。操作系统只负责为通信进程提供可共享使用的存储空间和同步互斥工具,而数据交换则由用户自己安排读/写指令完成。

需要注意的是,用户进程空间一般都是独立的,要想让两个用户进程共享空间必须通过特殊的系统调用实现,而进程内的线程是自然共享进程空间的。

消息传递

在消息传递系统中,进程间的数据交换是以格式化的消息(Message)为单位的。若通信的进程之间不存在可直接访问的共享空间,则必须利用操作系统提供的消息传递方法实现进程通信。进程通过系统提供的发送消息和接收消息两个原语进行数据交换。

1) 直接通信方式:发送进程直接把消息发送给接收进程,并将它挂在接收进程的消息缓冲队列上,接收进程从消息缓冲队列中取得消息。

2) 间接通信方式:发送进程把消息发送到某个中间实体中,接收进程从中间实体中取得消息。这种中间实体一般称为信箱,这种通信方式又称为信箱通信方式。该通信方式广泛应用于计算机网络中,相应的通信系统称为电子邮件系统。

管道通信

管道通信是消息传递的一种特殊方式。所谓“管道”,是指用于连接一个读进程和一个写进程以实现它们之间通信的一个共享文件,又名pipe文件。向管道(共享文件)提供输入的发送进程(即写进程),以字符流形式将大量的数据送入(写)管道;而接收管道输出的接收进程(即读进程),则从管道中接收(读)数据。为了协调双方的通信,管道机制必须提供以下三方面的协调能力:互斥、同步和确定对方的存在。

  1. 进程同步
    多进程虽然提高了系统资源利用率和吞吐量,但是由于进程的异步性可能造成系统的混乱。进程同步的任务就是对多个相关进程在执行顺序上进行协调,使并发执行的多个进程之间可以有效的共享资源和相互合作,保证程序执行的可再现性

同步机制需要遵循的原则:

空闲让进:当没有进程处于临界区的时候,应该许可其他进程进入临界区的申请
忙则等待:当前如果有进程处于临界区,如果有其他进程申请进入,则必须等待,保证对临界区的互斥访问
有限等待:对要求访问临界资源的进程,需要在有限时间内进入临界区,防止出现死等
让权等待:当进程无法进入临界区的时候,需要释放处理机,边陷入忙等
经典的进程同步问题:生产者-消费者问题;哲学家进餐问题;读者-写者问题

同步的解决方案:管程,信号量。

  1. 用户态和核心态

image.png

当程序运行在3级特权级上时,就可以称之为运行在用户态,因为这是最低特权级,是普通的用户进程运行的特权级,大部分用户直接面对的程序都是运行在用户态;

反之,当程序运行在级特权级上时,就可以称之为运行在内核态。

虽然用户态下和内核态下工作的程序有很多差别,但最重要的差别就在于特权级的不同,即权力的不同。运行在用户态下的程序不能直接访问操作系统内核数据结构和程序。

当我们在系统中执行一个程序时,大部分时间是运行在用户态下的,在其需要操作系统帮助完成某些它没有权力和能力完成的工作时就会切换到内核态。

用户态切换到内核态的3种方式

1) 系统调用:这是用户态进程主动要求切换到内核态的一种方式,用户态进程通过系统调用申请使用操作系统提供的服务程序完成工作。而系统调用的机制其核心还是使用了操作系统为用户特别开放的一个中断来实现,例如Linux的int 80h中断。

2) 异常:当CPU在执行运行在用户态下的程序时,发生了某些事先不可知的异常,这时会触发由当前运行进程切换到处理此异常的内核相关程序中,也就转到了内核态,比如缺页异常。

3) 外围设备的中断:当外围设备完成用户请求的操作后,会向CPU发出相应的中断信号,这时CPU会暂停执行下一条即将要执行的指令转而去执行与中断信号对应的处理程序,如果先前执行的指令是用户态下的程序,那么这个转换的过程自然也就发生了由用户态到内核态的切换。比如硬盘读写操作完成,系统会切换到硬盘读写的中断处理程序中执行后续操作等。

  1. 死锁
    死锁是指多个进程在运行过程中,因为争夺资源而造成的一种僵局,如果没有外力推进,处于僵局中的进程就无法继续执行。

死锁原因:

竞争资源:请求同一有限资源的进程数多于可用资源数
进程推进顺序非法:进程执行中,请求和释放资源顺序不合理,如资源等待链
死锁产生的必要条件:

互斥条件:进程对所分配的资源进行排他性的使用
请求和保持条件:进程被阻塞的时候并不释放锁申请到的资源
不可剥夺条件:进程对于已经申请到的资源在使用完成之前不可以被剥夺
环路等待条件:发生死锁的时候存在的一个 进程-资源 环形等待链
死锁处理:

预防死锁:破坏产生死锁的4个必要条件中的一个或者多个;实现起来比较简单,但是如果限制过于严格会降低系统资源利用率以及吞吐量

避免死锁:在资源的动态分配中,防止系统进入不安全状态(可能产生死锁的状态)-如银行家算法

检测死锁:允许系统运行过程中产生死锁,在死锁发生之后,采用一定的算法进行检测,并确定与死锁相关的资源和进程,采取相关方法清除检测到的死锁。实现难度大

解除死锁:与死锁检测配合,将系统从死锁中解脱出来(撤销进程或者剥夺资源)。对检测到的和死锁相关的进程以及资源,通过撤销或者挂起的方式,释放一些资源并将其分配给处于阻塞状态的进程,使其转变为就绪态。实现难度大

  1. 进程调度算法
    先来先服务调度算法FCFS:既可以作为作业调度算法也可以作为进程调度算法;按作业或者进程到达的先后顺序依次调度;因此对于长作业比较有利;

短作业优先调度算法SJF:作业调度算法,算法从就绪队列中选择估计时间最短的作业进行处理,直到得出结果或者无法继续执行;缺点:不利于长作业;未考虑作业的重要性;运行时间是预估的,并不靠谱 ;

高相应比算法HRN:响应比=(等待时间+要求服务时间)/要求服务时间;

时间片轮转调度RR:按到达的先后对进程放入队列中,然后给队首进程分配CPU时间片,时间片用完之后计时器发出中断,暂停当前进程并将其放到队列尾部,循环 ;

多级反馈队列调度算法:目前公认较好的调度算法;设置多个就绪队列并为每个队列设置不同的优先级,第一个队列优先级最高,其余依次递减。优先级越高的队列分配的时间片越短,进程到达之后按FCFS放入第一个队列,如果调度执行后没有完成,那么放到第二个队列尾部等待调度,如果第二次调度仍然没有完成,放入第三队列尾部…。只有当前一个队列为空的时候才会去调度下一个队列的进程。

  1. 内存连续分配
    主要是指动态分区分配时所采用的几种算法。
    动态分区分配又称为可变分区分配,是一种动态划分内存的分区方法。这种分区方法不预先将内存划分,而是在进程装入内存时,根据进程的大小动态地建立分区,并使分区的大小正好适合进程的需要。因此系统中分区的大小和数目是可变的。

image.png

首次适应(First Fit)算法:空闲分区以地址递增的次序链接。分配内存时顺序查找,找到大小能满足要求的第一个空闲分区。

最佳适应(Best Fit)算法:空闲分区按容量递增形成分区链,找到第一个能满足要求的空闲分区。

最坏适应(Worst Fit)算法:又称最大适应(Largest Fit)算法,空闲分区以容量递减的次序链接。找到第一个能满足要求的空闲分区,也就是挑选出最大的分区。

  1. 基本分页储存管理方式
    把主存空间划分为大小相等且固定的块,块相对较小,作为主存的基本单位。每个进程也以块为单位进行划分,进程在执行时,以块为单位逐个申请主存中的块空间。

因为程序数据存储在不同的页面中,而页面又离散的分布在内存中,因此需要一个页表来记录逻辑地址和实际存储地址之间的映射关系,以实现从页号到物理块号的映射。

由于页表也是存储在内存中的,因此和不适用分页管理的存储方式相比,访问分页系统中内存数据需要两次的内存访问(一次是从内存中访问页表,从中找到指定的物理块号,加上页内偏移得到实际物理地址;第二次就是根据第一次得到的物理地址访问内存取出数据)。

image.png

为了减少两次访问内存导致的效率影响,分页管理中引入了快表机制,包含快表机制的内存管理中,当要访问内存数据的时候,首先将页号在快表中查询,如果查找到说明要访问的页表项在快表中,那么直接从快表中读取相应的物理块号;如果没有找到,那么访问内存中的页表,从页表中得到物理地址,同时将页表中的该映射表项添加到快表中(可能存在快表换出算法)。

在某些计算机中如果内存的逻辑地址很大,将会导致程序的页表项会很多,而页表在内存中是连续存放的,所以相应的就需要较大的连续内存空间。为了解决这个问题,可以采用两级页表或者多级页表的方法,其中外层页表一次性调入内存且连续存放,内层页表离散存放。相应的访问内存页表的时候需要一次地址变换,访问逻辑地址对应的物理地址的时候也需要一次地址变换,而且一共需要访问内存3次才可以读取一次数据。

12.基本分段储存管理方式
分页是为了提高内存利用率,而分段是为了满足程序员在编写代码的时候的一些逻辑需求(比如数据共享,数据保护,动态链接等)。

分段内存管理当中,地址是二维的,一维是段号,一维是段内地址;其中每个段的长度是不一样的,而且每个段内部都是从0开始编址的。由于分段管理中,每个段内部是连续内存分配,但是段和段之间是离散分配的,因此也存在一个逻辑地址到物理地址的映射关系,相应的就是段表机制。段表中的每一个表项记录了该段在内存中的起始地址和该段的长度。段表可以放在内存中也可以放在寄存器中。

image.png

访问内存的时候根据段号和段表项的长度计算当前访问段在段表中的位置,然后访问段表,得到该段的物理地址,根据该物理地址以及段内偏移量就可以得到需要访问的内存。由于也是两次内存访问,所以分段管理中同样引入了联想寄存器。

分段分页方式的比较
页是信息的物理单位,是出于系统内存利用率的角度提出的离散分配机制;段是信息的逻辑单位,每个段含有一组意义完整的信息,是出于用户角度提出的内存管理机制

页的大小是固定的,由系统决定;段的大小是不确定的,由用户决定

  1. 虚拟内存
    如果存在一个程序,所需内存空间超过了计算机可以提供的实际内存,那么由于该程序无法装入内存所以也就无法运行。单纯的增加物理内存只能解决一部分问题,但是仍然会出现无法装入单个或者无法同时装入多个程序的问题。但是可以从逻辑的角度扩充内存容量,即可解决上述两种问题。

基于局部性原理,在程序装入时,可以将程序的一部分装入内存,而将其余部分留在外存,就可以启动程序执行。在程序执行过程中,当所访问的信息不在内存时,由操作系统将所需要的部分调入内存,然后继续执行程序。另一方面,操作系统将内存中暂时不使用的内容换出到外存上,从而腾出空间存放将要调入内存的信息。这样,系统好像为用户提供了一个比实际内存大得多的存储器,称为虚拟存储器。

虚拟存储器的特征:

多次性:一个作业可以分多次被调入内存。多次性是虚拟存储特有的属性
对换性:作业运行过程中存在换进换出的过程(换出暂时不用的数据换入需要的数据)
虚拟性:虚拟性体现在其从逻辑上扩充了内存的容量(可以运行实际内存需求比物理内存大的应用程序)。虚拟性是虚拟存储器的最重要特征也是其最终目标。虚拟性建立在多次性和对换性的基础上行,多次性和对换性又建立在离散分配的基础上

  1. 页面置换算法
    最佳置换算法:只具有理论意义的算法,用来评价其他页面置换算法。置换策略是将当前页面中在未来最长时间内不会被访问的页置换出去。

先进先出置换算法:简单粗暴的一种置换算法,没有考虑页面访问频率信息。每次淘汰最早调入的页面。

最近最久未使用算法LRU:算法赋予每个页面一个访问字段,用来记录上次页面被访问到现在所经历的时间t,每次置换的时候把t值最大的页面置换出去(实现方面可以采用寄存器或者栈的方式实现)。

时钟算法clock(也被称为是最近未使用算法NRU):页面设置一个访问位,并将页面链接为一个环形队列,页面被访问的时候访问位设置为1。页面置换的时候,如果当前指针所指页面访问为为0,那么置换,否则将其置为0,循环直到遇到一个访问为位0的页面。

改进型Clock算法:在Clock算法的基础上添加一个修改位,替换时根究访问位和修改位综合判断。优先替换访问位和修改位都是0的页面,其次是访问位为0修改位为1的页面。

最少使用算法LFU:设置寄存器记录页面被访问次数,每次置换的时候置换当前访问次数最少的。

四、总结

以上只是针对操作系统重点知识点的总结,如果没有相应的操作系统基础的话,可能不太好理解,下面推荐自己学习操作系统过程中参考的一些资料。

推荐课程:操作系统

传送门

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×